So i have a 32x32 acid sprite with animations that’s repeated over the area. The animation is made in a way that these 32x32 seems like a whole sprite.
But the problem is that whenever that sprite is off screen animations stop syncing. I’ve tried to find a way to match one sprites frame to the other (the top part of the acid is different so i’m using the top part to determine others’ frames) but i couldn’t find an action to do that.
I’ve tried these actions aswell but they don’t work either
How can i fix that problem? I don’t want to keep the sprite awake at all times (if that’s even an option) for performance reasons so is there any way i can just match the frames between the top and the bottom ones so they won’t be out of sync?
I sometimes capture the current animation frame of an object in a variable. It’s done like this:
In this example trevorSmall is my object and I get its current animation frame with .Sprite()
I then use the value of the variable to set the animation of a new instance of my object, like this:
Perhaps you can use this technique to synch one animation with another, by capturing the current frame of an object and using that value to set the frame of another object.
Anims that you want to synch with each other would need the same number of animation frames e.g. if one object has 20 frames and the other has 19, they would only be in synch for 19 frames (assuming they both start at frame 0 and have the same anim speed). Also, things wouldn’t work if frame 20 of one object was stored in a variable and applied to the object with only 19 frames.
It’d probably go the same way as loop though. I need to find a way for bottom sprites to go along with the top part.
That’s keeping the sprite awake right? I guess that’s the last resort if i can’t find a solution
That’s a good idea thanks. Both have the same amount of frames yeah it’s just that top part is different. I’ll give it a try when i have time thanks for the help
I sometimes capture the current animation frame of an object in a variable. It’s done like this:
In this example trevorSmall is my object and I get its current animation frame with .Sprite()
I then use the value of the variable to set the animation of a new instance of my object, like this:
Perhaps you can use this technique to synch one animation with another, by capturing the current frame of an object and using that value to set the frame of another object.
Anims that you want to synch with each other would need the same number of animation frames e.g. if one object has 20 frames and the other has 19, they would only be in synch for 19 frames (assuming they both start at frame 0 and have the same anim speed). Also, things wouldn’t work if frame 20 of one object was stored in a variable and applied to the object with only 19 frames
Hmm that’s interesting. The .Sprite() action doesn’t seem to work.
I’ve used both .Sprite() and .AnimFrame on text to see what’s wrong and it doesn’t change the number. However when i tick the option to keep it awake at all times text starts showing the animation frames. Odd…
I think for now as a temporary solution i’ll just keep the top part awake and use .Sprite to change the frame of the bottom parts.
I’m using a global variable, not an object variable. It’s a structure variable called trevorTracker.
currentAnimFrame is a child of that structure variable and is a number. It’s not a special function.
In my game I save the current animation frame of my character to the variable, using .Sprite() to access it. Then I delete the character, create a new instance of the character, and set his animation frame to the value of the variable. The player never knows he was deleted because the animation of the new instance carries on from the deleted instance’s animation frame (it’s a long story why I need to do this and not relevant to your post, so I won’t go into it).
I showed you the screenshots from my game to show you .Sprite(), for accessing the current animation frame of an object, because I thought it might help. Sorry if any of that caused confusion.
Oh no worries at all it actually did help. I just kept one of the sprites awake at all times while rest can sleep. It’s still like a risky move but works for now. I’m not sure why .Sprite() doesn’t really return the number if i don’t tick the keep awake at all times.
I guess my guess would be maybe if your player sprite has platformer behaviour or something similar to that sense it just automatically keeps it awake?
I’d still guess that sprite would return the number even without the tick though so i’m guessing it’s probably a bug. Thanks for the help again i’d otherwise keep each sprite awake at all times and it’d be a pretty big problem in the future