draw_sprite( spr_gun, -1 ) not animating

Bentley

Member
Hello. Just to give you a heads up, I'm a bit of a beginner.

For some reason, the following code won't animate the sprite:

draw_sprite( spr_gun, -1, x, y );

It works in other objects, just not in the object I want.

Some additional info:

-The object I want the code in has its own sprite.

-spr_gun has more than one sub-image (so that's not the problem).

Any ideas? Thanks for reading.
 
Last edited:

Kyon

Member
Hello. Just to give you a heads up, I'm a bit of a beginner.

For some reason, the following code won't animate the sprite:

draw_sprite( spr_gun, -1, x, y );

It works in other objects, just not in the object I want.

Some additional info:

-The object I want the code in has its own sprite.

-spr_gun has more than one sub-image (so that's not the problem).

Any ideas? Thanks for reading.
try
Code:
draw_sprite(spr_gun,image_index,x,y);
 

Jakylgamer

Member
if the main sprite for the object doesnt have more than one sub-image it wont animate.
so make sure the main sprite has the same amount of sub images as the one you want to animate.
also as stated make sure image_speed isnt set to 0
 

Kyon

Member
You could also make a variable in create event like this:
Code:
index=0;
then in the step event:
Code:
index+=1;
then draw it like:
Code:
draw_sprite(spr_gun,index,x,y);
That should work.
 

Bentley

Member
if the main sprite for the object doesnt have more than one sub-image it wont animate.
so make sure the main sprite has the same amount of sub images as the one you want to animate.
also as stated make sure image_speed isnt set to 0
Oh wow, I had no idea. The object's main sprite does only have one sub-image. I'll test it now.

Edit: Yeah, that was the problem. Thank you Jakylgamer. And thank you everyone for the replies. Solved!
 
Last edited:
Top