Hi guys, I’m totally new to this world so I decided to approach to a topdown movement game, kinda oldschool RPG, the thing is that I’ve tried to create an animation tree with idle/walk/run animations in every direction and associate it to the code with some variables like “horizontal” and “vertical” velocity but I don’t know to what I must multiply those variables to get the desired result also for the movement I used the “addforce” code to get that lil bit of deelay when you do some actions and to feel the character heavyer and real and the animation must switch depending from the actual speed of the character like when you just run and when you increase the speed you sprint, If you can just send me, please, some sample code or an example of what I should do.
I hope that I explained myself well, also my english is not that good :p, I’m not a programmer and still learn the basics of the basics so if I do any ask that seems stupid please don’t judge me.
Holy run-on sentence Batman. So, some advice with posting here: You need to say what is happening currently, if there are any errors and what you have tried. You explained what you want to happen so that is good. But most people won’t just give you a full script, just fyi.
As for your actual problem. It sounds like you are trying to find this “perfect” movement speed with your walk and sprint. I would take the complexity out of it since it is only a top-down 2D rpg where the actual animations arent different visually that much (besides speed). You should have a walk animation and a sprint animation. If you dont have the sprint, then just recreate the walk but make the frames more condensed so it appears faster. Then, when you press or hold a button, it will switch to the sprint. It will A) Switch to sprint animation and B) Increase the movement velocity while sprint button is held. If sprint button is not held, velocity goes back to what is was for walk and so does the animation.
I think I understand what you mean but the thing here is that I used an addforce script for one reason, i just want the character to feel more heavy and I want the animations to sync with the player’s actual velocity,the velocity is not constant but based by the force so there is some acceleration and deceleration between the idle state and the max speed is the fvalue of 1 and I just want to multiply the animations variables by the variable of the momentary speed, for example when the object starts moving and has not yet reached the velocity of 1 so for example it’s 0.5 it should play walk animation based on the animation tree. I hope to be as clear as possible, my english doesn’t shine so if you understood something about what I’ve said it will be nice. PS I don’t want to create any sprint animation.
Btw I don’t hope that someone gives me magically the script but you know, it’s just a 2D walking script, not a NASA spacecraft AI script and but any kind of help is appreciated! ^^