Stop an on screen animation

Is there a way to stop an animation that is playing on screen (not in battle)?

I want the animation to play, but I also want to be able to cancel it under a certain condition.

Here's an example, I would like the bouncing coin to disappear after the player touches it.

Testing this now but might just do...
For Player
$gamePlayer._animationId = 0;

For Event:
$gameMap.event(EventIDGoesHere)._animationId = 0;

Nope not working exactly as needed... brb


see below
Cool, I'm curious to see if you can solve it 🙂
How are you making the animation? Is it an animation from the Animations tab, or do you have some kind of move route or stepping animation on an event?
It's an animation played using the option "Show Animation" on page 2 of the event commands.
Is there a way to stop an animation that is playing on screen (not in battle)?
I want the animation to play, but I also want to be able to cancel it under a certain condition.
*Tada!*
Seems to work, testing more now 🙂
Code:
var eventId = 1, animationIndex = 0;
SceneManager._scene._spriteset._characterSprites[eventId -1].parent.removeChild(SceneManager._scene._spriteset._characterSprites[eventId -1]._animationSprites[animationIndex]);

see below
Omg! Yes! You are a genius! 😀 😀 😀 Thank you so much @ct_bolt I wish I could give you a cookie :LZSlol:

This is the finshed result
Aww yay! No prob! Awesome glad to hear it works as needed!

Honestly a fun challenge and could be useful for me someday also. 😉

Happy Game Making! 🙂
I have a quick question. It only seems to work for the first animation played in the map, is there a way to reset it?
I have a quick question. It only seems to work for the first animation played in the map, is there a way to reset it?
@Tea's Jams
*Fixed*
Ahh much better 😉
Code:
var eId = 1, animIndex = 0; SceneManager._scene._spriteset._characterSprites[eId -1]._animationSprites[animIndex]._duration = 0;

Let me know how it goes, seems to work as it should now. 🙂


see below
Hmm, I wonder if I'm doing it wrong somehow, I get this error.
1582581568139.png

1582581617640.png


1582581635773.png


1582581657238.png



EDIT**** I should clarify, I get the error after the second animation tries to turn off, the first one works great.
second animation tries to turn off
Can you be more specific, what's the event id? (if it's not 1 then of course it will fail especially since your erasing that event)
... brb, see below soon
The event ID for the second event is 003.
lmao well that's the problem
code I gave you was like a demo piece showing using eventId #1 only...

*poof* *tada* *poof*

Here ya go 😉

Place this in a route movement script call to use the event Id of the moveroute 🙂
Code:
SceneManager._scene._spriteset._characterSprites[this._eventId -1]._animationSprites[0]._duration = 0;
1582594121468.png


Let me know how it goes, working great for me 🙂

see below
Yuuusssss, now I want to give you a whole BATCH of cookies!!! Thank you! I feel kinda dumb for not figuring that out, I actually do know a little JS... (if you can believe it, lol)

Make sure to message me about the tutorial, I want to help you out. 🙂
Yuuusssss, now I want to give you a whole BATCH of cookies!!! Thank you! I feel kinda dumb for not figuring that out, I actually do know a little JS... (if you can believe it, lol)

Make sure to message me about the tutorial, I want to help you out. 🙂
Aww yay! No probs.

I did come across one more issue when spamming the "stop animation" command when no animation was playing... so I fixed that too now 😉

*poof* tada* *yay* *hurrah* *no more crashy boom boom*

Use this to make sure even if the event doesn't have the animation it won't just crash:
Code:
if (SceneManager._scene._spriteset._characterSprites[this._eventId -1]._animationSprites[0]) SceneManager._scene._spriteset._characterSprites[this._eventId -1]._animationSprites[0]._duration = 0;

Happy Game Making!

PS. @tutorial
Awesome! Sounds like a plan I'll send ya a msg soon 😉

psst... Your game (clone game) is looking pretty cool by the way. 🙂
Nice, I'm glad you thought of that! It works beautifully! 😀

Thank you, it's just a little fun project for a jam I can't win lol

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/stop-an-on-screen-animation.118545/