This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Right now I have a vn kind of thing I'm working on that has some animations in it. But whenever it goes from one animation to another, it will start the next animation from the same frame as the previous one. So if its frame 6 of the first anim, it will start on frame 6 of the next one.
I want it to always start on the first frame and loop from there. This is an excerpt from the code I'm using right now.
>Draw event
if _scene1=1
{
draw_sprite_ext(Maxine_intro_image, image_index/4, 0, 0, 1, 1, 0, c_white, 1);
}
if _scene2=1
{
draw_sprite_ext(Maxine_start, -1, 0, 0, 1, 1, 0, c_white, 1);
}
if _scene3=1
{
draw_sprite_ext(Maxine_loop1, image_index/6, 0, 0, 1, 1, 0, c_white, 1);
}
if _scene4=1
{
draw_sprite_ext(Maxine_loop2, image_index/6, 0, 0, 1, 1, 0, c_white, 1);
}
-------------------------------------------------------
Rudimentary I know, but I'm pretty new and it works fine for images xD
I use a plugin called chatterbox which lets me change variables in between dialogue to set the variables to what I want during the step event to activate these if statements, I could post examples of how that looks here but I don't think its relevant to this issue so I left it out.
My Attempted solutions
-----------------------------------------------------------------
I tried setting the image index to zero before the draw_sprite line but that just freezes them on the first frame, even if I try and change it later. I tried about 20 ways to do this and they all just froze or did nothing.
I also found someone on an older gm forum that said to put this in.
>create
last_sprite = 0;
>end step
if (last_sprite != sprite_index) {
image_index = 0;
last_sprite = sprite_index;
}
This didn't seem to do anything when I put it in, positive or negative.
I found another forum post that mentioned changing game states to reset the sprite_index but I couldn't find any way to actually do that.
---------------------------------------------------------------------------------------
Sorry in advance if its a simple question but I genuinely haven't found any resource that describes how to have animations always play from frame 1 and loop properly. I'd appreciate any advice on this.
Subreddit
Post Details
- Posted
- 6 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/gamemaker/c...