actor animated to an attack position to hit the enemy

Hello GS members!

I made a game which allows the player to control my main actor to attack the enemy.moreover, when the button is clicked, it is also animated to an attack position to kill the enemy.

as for the enemy, he is moving to the left to collide with my main actor.

Question:

1.) How do I make the enemy die / disappear when my main actor is animated to an attack position to hit the enemy?


2.) How do I make my main actor still? cause when the enemy collides with my main actor, he seems to move to the left and sometimes float in the middle of the scene.

3.) I have enabled wrap x for the enemy but the enemy only appears once. what's the solution to it? I would like the enemy to appear 8 times in the scene.


I appreciate it if anyone can help me. thanks :)


Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    1) There are numerous discussion threads about custom animation timers. Find one and follow the directions. That way you can keep track of which animation frame you are on and create a rule for it.

    2) Use a collision rule but don't add a Collide behavior to either actor. Or turn off bounciness on both actors if you need to use a collision rule.

    3) Scene wrap just allows moving actors to reappear on the other side. What does that have to do with 8 enemies? Post a screenshot of your spawn and enemy movement rules (and maybe a screenshot of your scene) and we'll go from there.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • motionlifemotionlife Member Posts: 15
    @tatiang


    Hello Tatiang

    Thank you for your response.

    With the regards to the custom animation you mentioned, I couldn't find a tutorial that exactly answers my question. perhaps you know a link to a free template that contains it or any useful links? can you post it here?


    I used a collision rule but I did not input any bounciness attribute.

    Lastly,

    I am attaching some screen shots.


    enemy

    http://i45.tinypic.com/29c0zrd.jpg

    main actor 1

    http://i48.tinypic.com/2lx6yc0.jpg

    main actor 2

    http://i49.tinypic.com/2h2jw9u.jpg

    any ideas on how to fix it?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Hmm, I'm not finding the threads but this one definitely has the answer (it's just a lot of work to get through!): http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips/p1.

    The general idea is that you use a timer to create the animation OR you check the self.Image name for a certain image and base your rule off of that.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • motionlifemotionlife Member Posts: 15
    @tatiang

    Thanks for the link but I must say, this is just too tedious for a complete beginner like me. lol.

    anyway, you mentioned about creating a rule self.Image. I think I just did that with my main actor ( please view the link in the previous comment).


    May I know what went wrong? how do I alter some changes in the rule?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2013
    I don't see anything in those rules that has to do with self.Image.

    The idea is to have a rule that says When attribute self.Image = [some image name] --> [perform some action]. self.Image is any one of the animated frames that you're using.

    I haven't actually tried that but someone mentioned it recently so it's worth testing out.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • motionlifemotionlife Member Posts: 15
    @tatiang :

    I've decided to try it out and made some modifications.

    under the animation of my main actor,

    I created a change attribute that sets self.image to main actor attack ( boolean attribute I created under "game") .

    I have also made some changes in my enemy.

    I created a new rule:

    when main actor attack is true,

    do

    on Timer

    after 1 seconds, run to completion

    and I have added a spawn actor, a mini explosion that signifies that the enemy is completely destroyed.

    I tried to preview the game, but still I did not have the effects I desired, am I missing something?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Try adding some Log Debugging Statements within each rule and then see if those statements appear in the Log Debugger Window. That will tell you if the rules are firing (with the attributes having the values you expect).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • motionlifemotionlife Member Posts: 15
    @tatiang :

    Thanks for your suggestion. I tried it and I happen to get a "0". I assume this means there is something wrong with my attribute or the rule I made for both actor and enemy? Please confirm.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I created a change attribute that sets self.image to main actor attack ( boolean attribute I created under "game").
    I didn't read this carefully enough last time. You're changing a text attribute (self.Image) to the value of a boolean attribute (0/1)? That doesn't make much sense to me unless you're using two images called 0.png and 1.png.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • motionlifemotionlife Member Posts: 15
    @tatiang :


    I don't understand. :(

    I just followed this tutorial to debug the game :

    Under the animation,I added an ON change attribute. I assume that changing the self.image to "main actor attack" refers to both images in the animation. am I right? also, May I know what are suggestions to improve the code for it to work?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    It seems like you didn't answer my question and I'm not sure what the debugging video has to do with anything. I'd like to help you but I'm a little lost as to what you're trying to do. Can you send me a link to download your file (please .zip it first) and I'll take a look at it?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • motionlifemotionlife Member Posts: 15
    @tatiang :

    I am absolutely confused too. :(

    anyway, Please check your inbox, I have included the link.
Sign In or Register to comment.