Bouncy Player
by Efra · in Torque Game Builder · 03/28/2006 (12:01 pm) · 4 replies
Hey guys!
First of all I wish to say that Torque2D is just a great product.
I recently bought it and was really amazed by all the featers and editors.
Still can't believe it's that cheap!
Here's my problem,
The player in the platform game I'm building is a ball-shape.
I want it to always keep bouncing up and down like a hyperactive squeezy guy.
Been trying lots of physics settings but I really can't seem to work it out.
Do anyone of you have an idea on how to accomplish this?
Again, the ball has to keep bouncing up and down (idle) a little bit, but higher when he jumps.
(One can press jump when the player is in air, than it makes itself heavy and bounces harder to jump higher than the idle-bouncing)
Thanks!
Efra
First of all I wish to say that Torque2D is just a great product.
I recently bought it and was really amazed by all the featers and editors.
Still can't believe it's that cheap!
Here's my problem,
The player in the platform game I'm building is a ball-shape.
I want it to always keep bouncing up and down like a hyperactive squeezy guy.
Been trying lots of physics settings but I really can't seem to work it out.
Do anyone of you have an idea on how to accomplish this?
Again, the ball has to keep bouncing up and down (idle) a little bit, but higher when he jumps.
(One can press jump when the player is in air, than it makes itself heavy and bounces harder to jump higher than the idle-bouncing)
Thanks!
Efra
#2
The jump also worked out spectaculair! Now, if the player jumps he moves straight down fast and therefore bounces higher. At the next bounce all is reset and the player happily bumps ahead.
Thanks Michael!
-Efraim
03/30/2006 (9:31 am)
Thanks for your reply Michael! I tried it and with some tweaks it works great!The jump also worked out spectaculair! Now, if the player jumps he moves straight down fast and therefore bounces higher. At the next bounce all is reset and the player happily bumps ahead.
Thanks Michael!
-Efraim
#3
03/30/2006 (9:46 am)
Glad I could help :)
#4
- Matt VG
04/26/2006 (8:00 am)
I was also doing something like this but for a slightly more realistic bounce I want to increase the only the force from the collision. setForceScale() applies to all forces. Is there a way I can multiply only the collision force?- Matt VG
Torque Owner Michael Woerister
%player.setCollisionActive(true,false); %player.setCollisionResponse( BOUNCE ); %player.setCollisionPhysics(false,true); %player.setCollisionLayers( %the_layers, %you_need); %player.setCollisionGroups( %the_groups, %you_need); // give the player a nearly circle collision poly. %player.setCollisionPolyPrimitive(32); // gravity. You'll have to just try who strong the force should be %player.setConstantForce("0 100", true);This should make the ball bounce. For the jump you could give the ball a push downwards so it will bounce up higher the next time:
// when the player is in air and already moving downwards do something like this: %player.setImpulseForce("0 200",true);You'll have to think of something what happens if the player is in air but still moving upwards and the jump-button gets pressed.
-Michael