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

[SOLVED] Way to have an animated object in a GUI?

T

tamation

Guest
I'm trying to include an animated sprite in my game as part of a GUI system, but the xview and yview options in the draw event only seem to draw one frame of the sprite.

I want a sprite to start at frame 0 and then end at frame 10, something I usually code in the create and animation end events of an object. I've tried including x = view_xiew and y = view_yview into the step event of my object and using the object for the GUI, but that has a very jittery and unclean effect.

Is there any easy way to achieve this? perhaps an animate and stop animation in the draw event when drawing a sprite with multiple indexes?
 

CloseRange

Member
so 1 thing to remember is that in the draw GUI function it draws directly to the view, not relevant to the view or your position. This means that position 0, 0 will always be in the top left corner of your screen while in the draw gui event.

that being said the reasion for the gittery effect is because the draw gets updated after the step so what you really should do is make an object (with the sprite) and put this in the draw gui event:
Code:
/// Draw GUI
draw_sprite(sprite_index, image_index, 0, 0);
this will draw its own sprite and index (so its animated) but in the gui (no gitter)
 
Top