SOLVED Animation script that speeds up/down based on speed.

SalTheThief

Member
I need help with the pseudo-code more than the actual code, I think.

I'm working on an action RPG and I want an animation script that will scale up or down based on how fast something is. For example, I want to have an attack that takes 1 second, but there is an item that increases attack speed, which now makes it half a second. Or if a player is moving very slowly it should slow down the image speed of the walk animation. What is the best way to implement something like this? Would I need two separate scripts?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Can't you just have a multiplier variable and then use that? So on game start you've got "multi = 1" and then in the code "image_spd = 0.5 * multi"? Then you change the multi value to be more or less and so increase/decrease the speed that something is done.
 

SalTheThief

Member
Can't you just have a multiplier variable and then use that? So on game start you've got "multi = 1" and then in the code "image_spd = 0.5 * multi"? Then you change the multi value to be more or less and so increase/decrease the speed that something is done.
I thought about doing this, but wouldn't this just make it play two attack animations in the time it would normally do one?
 

Nidoking

Member
That is, indeed, what doubling the speed of animation is. That is the definition of "double" or "twice". It is precisely what you asked. Are you perhaps not using the Animation End event to detect when the animation finishes? If you're using some other timer, then you can also apply the same change to the value of that timer. Numbers are numbers no matter where they are.
 

SalTheThief

Member
Sorry, I should have phrased that better. My question was if it would keep the duration of the animation but would play it twice. I wasn't aware of the Animation End event, but thank you! I will do some reading and try to come up with something.
 
Top