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

GameMaker [SOLVED] Sprites' speed in the same Draw GUI

SubWolf

Member
Hello everyone,

I'm having this problem with GMS2... I have one object that is called to draw a kind of window with buttons and some images (sprites). I draw these different sprites in the "Draw GUI" of the object, something like:

draw_sprite(spr_ball_1, -1, x, y);
draw_sprite(spr_ball_2, -1, x, y);

But let's say that I want different "image_speed" for each one... or I want to check if the spr_ball_1 is in a certain image_index. There's any way I can do this in the Draw GUI of an object that I drawn these two sprites? Or I have to create them separately as 2 instances? Because if I try to use "image_index" or "image_speed" it will return these attributes for the sprite of the object I'm in the Draw GUI... even if it doesn't have any sprite.
 

SubWolf

Member
Sorry, but could you be more specific?
If I understood right you said that I should create a variable to mimic the usage of image_index and image_speed, that's it?
But I want to control that attributes for each sprite I draw in the Draw GUI event of the same object.
How can I do that?

Thanks for the answer.
 

rIKmAN

Member
Sorry, but could you be more specific?
If I understood right you said that I should create a variable to mimic the usage of image_index and image_speed, that's it?
But I want to control that attributes for each sprite I draw in the Draw GUI event of the same object.
How can I do that?

Thanks for the answer.
If you have 2 different balls that you want to have different properties such as speed, direction, image_index etc then you should be using 2 seperate instances of your ball object.
 

samspade

Member
Sorry, but could you be more specific?
If I understood right you said that I should create a variable to mimic the usage of image_index and image_speed, that's it?
But I want to control that attributes for each sprite I draw in the Draw GUI event of the same object.
How can I do that?

Thanks for the answer.
Either you would make your own simple animation system (which isn't really that hard) or you should be using two different instances.

Here are two tutorials on full custom animation systems. Both are much more than you need, but you can take the basic ideas for incrementing and looping an image index (which is all that is really needed to animate a sprite) and use that by itself.

Building A Better Animation System in GameMaker: Studio
https://forum.yoyogames.com/index.php?threads/simple-animation-system.25929/#post-186335
 

SubWolf

Member
If you have 2 different balls that you want to have different properties such as speed, direction, image_index etc then you should be using 2 seperate instances of your ball object.
I imagined that solution, but I thought of trying to manipulate the animation in the Draw GUI event to not have to create more instances... I think that use memory so if I have to create a lot maybe can cause lag. But thanks, I think I'll do this!
 

SubWolf

Member
Either you would make your own simple animation system (which isn't really that hard) or you should be using two different instances.

Here are two tutorials on full custom animation systems. Both are much more than you need, but you can take the basic ideas for incrementing and looping an image index (which is all that is really needed to animate a sprite) and use that by itself.

Building A Better Animation System in GameMaker: Studio
https://forum.yoyogames.com/index.php?threads/simple-animation-system.25929/#post-186335
Thanks very much, I'll check theses tutorials as soon as I get home!
 
Top