I want a sprite object to have the same behavior as the jump event command. What formula or code should I use so it would jump from left to right for example? I am trying to do this on the update method of my scene.
Formula for Jump?
Learning JavascriptI'm personally using a really good script for this called GALVs jump ability.
https://galvs-scripts.com/galvs-jump-ability/
You can turn it off and on using the following plugin commands:
JUMPACTION FALSE - to turn it off.
JUMPACTION TRUE - to turn it off.
He has it free to use for commercial use. I'm sure there's a way to get it to be activatable through javscript as well.
Otherwise, I would do it through a common event that does Set Movement Route. It keeps things simple doing it through eventing, and then activating that eventing using coding:
$gameTemp.reserveCommonEvent(ID);
Just under your common event's movement route do "Start Jump" and then "Move Forward" then "End Jump".
Oh nevermind after checking rpg maker no longer does the start jump end jump thing. Hmmm...You'd have to just do it through math. Open up GALVs jump ability script and see how he did it for a reference if you want to do it yourself.
Game_Characterbase has a method called update_jump (or updateJump in JS) which I think is where the calculation is done. It's not just a simple formula - it's an update that's run each frame to determine where the sprite should be based on the progress through the jump.
Thank you for the heads up. If I want to do this via the character sprite in battle, like, I want the character entrance as jump instead of walking, basing from this updated formula, how can go about doing it?
In battle, you'd be looking for Game_Battler and Game_BattlerBase methods. tbh I'm not sure as I don't do much scripting in the battle system. If you're using any of Yanfly's battle plugins, there might be something there that would already let you do it, or that you could use as a starting point.
I'll try to look it up and see if there's something more I am missing for this to work.
Original thread: https://forums.rpgmakerweb.com/threads/formula-for-jump.63448/