Timer for animating
![InLaNoche](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Pretty new to GS, but have played with Coding in the past. I thought I would try a simple character walking around the screen. With that I decided to add a standing animation while not moving. I only have 5 frames, so I don't want it to run all the time. So I decided to put in a timer (5 sec) and then under that I added the animate. I added the frames, set to animate at 8 fps, turned off Loop.
I ran my test and nothing. If I take the animate out of the timer block it works...
I ran my test and nothing. If I take the animate out of the timer block it works...
Best Answer
-
gyroscope I am here.Posts: 6,598
Hi, if I could understood exactly what you're after by a random delay on your stationary animation, I'm sure there'd be a way to get what you're after...
Yes, Horizontal Flip is what you need. So, copy all your animation frames in the Inspector and then go into each one's Editor and check Horizontal Flip. Then these are dragged into the Animation Behaviour for the walking left and so will be the correct-facing way. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Answers
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@InLaNoche
Hi and welcome to the wonderful world of GSC! As you have played with coding in the past, especially if it's one of the BASIC type of programming, you should feel at home with Rules relatively quickly.
The reason why the Animate Behaviour didn't work in a Timer is because there would be a clash with the Timer and the animation Behaviour - this already has the timing built into it (frames per second).
One way which would be usual, so as to stop and start the animation as you want, would be to have a button. let's call this first button Right. Make a text attribute and call it AnimDir. In the Rules of Right actor:
When touch is pressed
Change Attribute AnimDir to R
When touch is released
Change Attribute AnimDir to none
I'm sure you'll at least want a left button and in that actor's Rules:
When touch is pressed
Change Attribute AnimDir to L
When touch is released
Change Attribute AnimDir to none
similar for up and down, depending on what sort of game you're making (you might just want an Up button for jumping only for instance; in a top-down game, you'd want all 4 directions).
In your actor which animates:
When attribute AnimDir = R
Animate Behaviour
When attribute AnimDir = L
Animate Behaviour --- with your frames flipped)
That should give you a start.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
You can Flip frames, as in horizontal flip in GS? I already got the walk left and right done, but I created twice the frames for walking (one set to the left, and one to the right), but flipping would save me a good bit of time.
though I like 1 index attribute for direction
@InLaNoche
use 1 character image and 1 animationSequence
demo: http://www.mediafire.com/?ux2c704nt27nl0j
Well if I use the 4 frames of animation for the stationary animation, he either bounces to fast, or it looks like slow motion. So (again, just for look, not for function) I was hoping to use a random adder (starts at 0 then +random(1,4) per second until it reaches 20. At that point, animate one cycle and reset the adder. Hope that gives insight on what I was messing with.
Also, I forgot to state that I was using the Windows GSC. I don't think I know what the "Inspector" is...
Wait, think I found it. Will test that now...
ok, no go. I see the check box in the actor's attributes, but I cannot use Change Attribute on it, it gives Invalid path...