• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Spritesheet Animation Help

N

Nathan Wilson

Guest
I'm using code based on FriendlyCosmonaut's spritesheet tutorial/code and I'm hitting a bit of a wall.

I'm attempting to use PVGames spritesheets as is (they are a 24 x 24 grid), but the animations wrap lines. Left -facing Idle animation starts at the last cell of row 6 and then starts again on the first cell of row 7.

How do code my animation sequence to smoothly animate a sequence broken across rows?

Here is my code so far.
Code:
anim_y_start = 6;
anim_x_start =  23;
anim_length = 3

//-- Animation Incrementing and Alarm[0]
if((anim_x_start + (anim_frame_count + anim_frame_speed/60)) < anim_x_start + anim_length)
{
    anim_frame_count += anim_frame_speed/60;
}
else { event_perform(ev_alarm, 0); }
I know that I need my anim_y_start to become 7 and anim_x_start to be set to 0, and I can code the conditions for that to happen, but I need it to also not mess up my counting and incrementing logic. So far everything I have tried has resulted in the animation doing wonky things.
 
Top