To create more realistic jumping and maybe adding in trampolines/springs in a game, how would you do this by simply changing the value of a thrust variable?
Thrust and Jumping
(8 posts) (4 voices)-
Posted 3 years ago #
-
You would have to change the thrust variable based on how how low the spring is. World 1 used animated springs, so they looked pretty bad, World 2 springs are done in code.
Doodle, sketch, draw, design, fill notebooks with elaborate scenes, funny character designs, and gameplay ideas.
Find your own personal style and run with it. Craft characters and stories that you love.
Enjoy your own work, and don’t be afraid to show it off. Create.Posted 3 years ago # -
I mean, how do you use a thrust variable to do that. Like is there a formuler?
Posted 3 years ago # -
You need to look into the idea of using velocity, then continuously adding to that velocity. A spring would set a very strong negative velocity (against gravity). So, in fakee code, you have:
springVelocity = -20;
//hero jumps on spring
heroVelocity.y += springVelocity;
//add the hero velocity to his position;
heroPosition.y += heroVelocity.y;A perfect book to get you started understanding simple physics is "Making Things Move" by Keith Peters. He has an AS2 and an AS3 version of the book.
http://blueflamedev.com/blog
Blueflame Development and the Citrus EnginePosted 3 years ago # -
i already use velocity and friction and other physics, i was wondering if there is a formula or how to fake it.
Posted 3 years ago # -
Well the question is, how do you want the spring to react? If you want the character to move upwards immediately, then just like motionsmith said, even more simply, character.moveY = spring.thrust. Otherwise, well, that's a bit more code...
Doodle, sketch, draw, design, fill notebooks with elaborate scenes, funny character designs, and gameplay ideas.
Find your own personal style and run with it. Craft characters and stories that you love.
Enjoy your own work, and don’t be afraid to show it off. Create.Posted 3 years ago # -
Well the question is, how do you want the spring to react? If you want the character to move upwards immediately, then just like motionsmith said, even more simply, character.moveY = spring.thrust. Otherwise, well, that's a bit more code...
Yeah heh...i'm looking for a gradual gaining of energy. More realism
Posted 3 years ago # -
you could use speed and friction?
i'm new to all this so that is proberbly really dumb.should i write something here? oh wait i am...thanks anywaysPosted 3 years ago #
Reply
You must log in to post.