• 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!

How to Account for Frame Length?

I'm having an issue where I'm trying to draw a sprite animation with variable frame lengths on the GUI layer. The sprite has a few frames of animation that are stretched (take up more than one frame) and some frames that aren't stretched. In the Step event I use a variable animframe that I increment by 0.1 and in the draw GUI event I use draw_sprite(sprite, animframe, x, y). This works for the most part, however the stretched frames are displayed for the same length of time as the non-stretched frames because the first frame is still considered image_index = 0 and frame 2 is always image_index = 1.
Is there any way to account for the stretched frames? I have worked around the issue by duplicating frames multiple times instead of stretching them, but I'd like to find a better solution.
Thanks!
 

kburkhart84

Firehammer Games
The new sprite editor actually lets you stretch frames out. Check the manual on it. It will be much easier doing this than trying to mess with coding it.
 
The new sprite editor actually lets you stretch frames out. Check the manual on it. It will be much easier doing this than trying to mess with coding it.
I am stretching out the frames. The issue is that when I draw the sprite to the GUI and use a variable to play the sub-images, the stretched frames play for the same duration as the non stretched frames.
 

kburkhart84

Firehammer Games
You shouldn't be using a variable to play the sub-images...you should be letting the engine handle it. That is the point. If you are needing to have more deep control, you are then replacing the in-engine stuff with your own, and then would need to replace that feature as well. I thought you were just using your own because you didn't know the engine could handle it.

Maybe if you better explained why you are using your own variables instead of letting the engine handle it...
 
I'm using my own variables because there are multiple draw_sprites in the draw GUI event. Sometimes I need to pause or play a sprite at a different fps. If there a better way to do this then I'm open to that.
 

kburkhart84

Firehammer Games
That's what the image_speed variable is for, as far as pausing and changing speeds.

And if you have separate objects you can just let the engine handle it instead of having a single object drawing multiple things. Some people prefer to handle it themselves, but as I mentioned above, you have to duplicate the feature you need, in this case, the stretched frames. Or you can just keep your workaround of duplicating frames. That's a pretty easy way and as long as you don't have big sprites you aren't wasting much space.
 
Top