Changing animations
batman189
Member Posts: 3
I am trying to change animations from idle to walking. I have a rule on my actor that when walking forward equals 0 then it should do the idle animation and when walking is 1 it should do the walking animation. Another rule on my button that says when it is pressed that walking should change to 1 and when touch is released it should be 0. The actor will idle fine at the game start, then move to walking fine as well. The problem is when the actor stops walking he does not go back to doing the idle animation. I am unsure what I am doing wrong, any help would be appreciated...I am less then a week into learning Gamesalad
Comments
I'm also fairly new to GS, so I'll do my best here. I had to wrestle with this one myself, batman189. The first thing I'd do is check every rule to make sure that everything is typed in and selected just the way you intended it to be. Next, try adding a new attribute to the rule you have, saying that when self.Motion.linearvelocityX is 0, then set 'walking forward' is 0. See if that helps.
Thanks for taking the time to reply. I did a little trouble shooting and put a character on the screen to show the value of game.forward so I can see what the values change to. What is happening is that when the button is pressed it goes to 1 but when it is released it says Nan instead of 0 or any other value. I am guessing that means that game.forward is not being set to 0 like the rule states it should when touch is released. I double checked the rule and it it set up properly.
Can you post a screen shot of the rule you are having an issue with - with the 'otherwise' section open.
Check out the Platformer Template on the GameSalad dashboard. It has a nice example of changing from idle to walking (er... running).
http://imgur.com/veSZhvq That is the imgur link. The rule to make forward.game works just fine but releasing the touch does not reset the value to 0. RThurman I will look for that article, I have yet to get very familiar with the site so I will do that now.
For the 'stop moving forward' change attribute behaviour . . . looks like you are using the letter 'o' rather than the number 0.
P.S. I think you can dump the whole stop moving forward rule and place the change attribute game.forward to 0 into the 'else' section of the first rule.
Like this:
socks I hate to admit your suggestion was correct simply because it just makes me look bad Thank you, it was in fact an o and not a Zero. I must have looked at it a hundred times and I just did not notice the error. I also moved to using the "else" instead of the second rule. Thank you very much for your reply, it is working great now.
You've already been placed on my 'he did what!?' list.
Cool ! Glad it works for you.
Free tip of the week !
Do you know that in walk animations - like the one you are using here - that you can reference individual frames for various fun stuff . . . for example if you wanted to sync a footstep noise each time your character's foot hits the floor then all you'd have to do is grab the name of the image where his foot is on the ground . . . . let's say your image sequence goes walk001, walk002, walk003 . . . etc etc . . and his foot is on the ground in frame 7 . . . so you'd stick in a rule like this . . . .
Rule: when self.image = 'walk007' - play sound 'footstep'.
So you get a walking character with a perfectly in sync footstep noise.
You can reference an animation's individual frames for lots of other cool things.