Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Changing animations for a platforming game

Author
Message
Cuurian
8
Years of Service
User Offline
Joined: 17th May 2016
Location: Hermosillo, Mexico
Posted: 27th May 2016 00:02
Hi guys, Im making a platform game and finally got to make the character move and jump and do basic stuff but im having trouble with changing animations, since i have a function that changes the animation depending of the direction, if the character is standing or jumping or walking, etc. but the problem is, using the function SetSpriteAnimation i could make just the walking animation to repeat, i only managed to make a static frame for the jumping and standing animations with setspriteframe() because if i try to use setspriteanimation and playsprite the animation just freezes between the 1st and 2nd frame and looks like the character is having a seizure

some quick tips about making diferent animations?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Jun 2016 23:59
It would be helpful to see the code that you are doing this in. It is very hard to make suggestions without knowing what you are already trying.
Cheers,
Ancient Lady
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 21st Jun 2016 15:26
Let's say you have four conditions for your sprite:

- Standing still, 4 frames
- Walking, 6 frames
- Jumping, 6 frames
- Crouching, 4 frames

Now, you load up all the frames into a sprite so as frame 1-4 is standing still, 5-10 is walking and so on.

To control it, you use the PlaySprite() command.

For instance, PlaySprite(spriteIndex, spriteFPS, loop, 1, 4) would play sprite spriteIndex at spriteFPS frames a second, if loop variable is 1, it will loop between frames 1 and 4. Which in this example would be the Standing Still animation. PlaySprite(spriteIndex, spriteFPS, loop, 5, 10) would be the walking animation. And so on. To Stop and Resume the animation, use StopSprite(spriteIndex) and resumeSprite(spriteIndex). To change direction of the sprite graphics, use setSpriteFlip(spriteIndex, horizontal, vertical) where a value of 1 for horizontal or vertical will flip on that axis, and 0 sets it to default direction.

Login to post a reply

Server time is: 2024-11-22 03:02:33
Your offset time is: 2024-11-22 03:02:33