Stop an on screen animation

Status
Not open for further replies.

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
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.

 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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
 
Last edited:

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
Cool, I'm curious to see if you can solve it :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,837
Reaction score
12,250
First Language
English
Primarily Uses
RMMV
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?
 

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
It's an animation played using the option "Show Animation" on page 2 of the event commands.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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
 
Last edited:

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
Omg! Yes! You are a genius! :D :D :D Thank you so much @ct_bolt I wish I could give you a cookie :LZSlol:

This is the finshed result
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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! :)
 

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
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?
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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
 
Last edited:

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
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.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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
 
Last edited:

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
The event ID for the second event is 003.
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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
 
Last edited:

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
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. :)
 

ct_bolt

Creator
Veteran
Joined
May 3, 2012
Messages
721
Reaction score
249
First Language
Javascript
Primarily Uses
RMMV
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. :)
 
Last edited:

Tea's Jams

I'm human
Veteran
Joined
Mar 28, 2017
Messages
827
Reaction score
2,023
First Language
English
Primarily Uses
RMMV
Nice, I'm glad you thought of that! It works beautifully! :D

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

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
2,622
Reaction score
3,793
First Language
English
Primarily Uses
RMMV

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.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I've developed a habit of thanking cleaning ladies for their work.
Sorry Aerith... I will abandon your shoes... :guffaw:
Spent a whole bunch of time today reworking the area in the video because someone said it was too illusory. So I reworked it so it changes less, moved the grass up to the same level as the player.... And found enough extra resources to make the grass moves when the player touches it. Also lots more water, because it looks amazing. I'll probably put up a short updated video later today.
I never noticed how NOISY birds can be in the morning..
The worst part of writing the thesis is getting to a point where it's nearly done and you feel like an 8th-grader could've written something on that level.

Forum statistics

Threads
95,766
Messages
931,709
Members
126,169
Latest member
Stearen
Top