Game Development Community

(solved Hi everyone, anyone know of jumping ability?

by Eliezer Cardona · in iTorque 2D · 06/19/2011 (3:57 pm) · 1 replies

Is there a way to have a jumping ability with a collision on detection. So if a player jump and land on a platform he should be able to jump right away only if the player let him. I have a timer on so every 2 second he can jump. But I want him to jump only when he touches something? If any have something or a forum which does this or a document let me know for my progress.

Thank you

#1
01/21/2012 (3:48 pm)
To use collision detection you have to enable it(in the player onLevelLoaded function):
%this.setCollisionCallback(true);

Then to detect a collision(change the object/variable names):
function player::onCollision(%srcObj, %dstObj, %this)
{
	if(%dstObj.class $= "ground")
	{
		$jumping = false;
	}
}