Help with jumping script
onClipEvent(load)
{
var count = 0;
var countHeight = 0;
var jump = false;
var jumpLevel = 2;
var jumpY = -9;
}
onClipEvent(enterFrame)
{
if(key.isDown(Key.CONTROL))
{
if(countHeight != 9)
countHeight ++;
if(jump != true)
jump = true;
}
if(jump)
{
count ++;
this._y += jumpY;
if(count == jumpLevel+countHeight)
{
jumpY = -jumpY;
}
if(count == 2*(jumpLevel+countHeight))
{
jumpY = -jumpY;
count = 0;
jump = false;
}
}
else
countHeight = 0;
}
{
jump = 0
jumping = false
floor = 300
}
onClipEvent(enterFrame)
{
keycontrol = Key.isDown(Key.CONTROL)
if(keycontrol and jumping == false)
{
jump = -20
jumping = true
}
else if(keycontrol and jump > 0)
{
jump -= 2
}
if(jumping == true)
{
jump += 4
_y += jump
if(_y > floor)
{
_y = floor
jumping = false
}
}
}
this should work... until you start adding things like platforms.
#If you have any other info about this subject , Please add it free.# |