I'm re-making my site, all proper (not all on flash like it is now) and it's gonna be a .com and there will be new stuff blahblahblah. on the site will be some minigames, 1 of which is a platformer, thing is, the script wont work like I want it to! the arrows are to move and up is to jump, but the thing is, you can just hold up and the char just keeps going up. its like jumping only you can just keep going. here is the script I have used for the mc player:
onClipEvent (load)
{
gravity = 10;
walkSpeed = 5;
maxJump = 4;
scale = _xscale;
}
onClipEvent (enterFrame)
{
if (Key.isDown(37))
{
_xscale = -scale;
_x = _x - walkSpeed;
this.gotoAndStop(2);
} // end if
if (Key.isDown(39))
{
_xscale = scale;
_x = _x + walkSpeed;
this.gotoAndStop(2);
} // end if
if (air == true)
{
_y = _y + gravity;
state = 3;
} // end if
if (_root.platforms.hitTest(_x, _y, true))
{
air = false;
}
else
{
air = true;
} // end if
if (Key.isDown(38) && jump == true)
{
_y = _y - jumpSpeed;
gotoAndStop(6);
} // end if
if (air == false)
{
jump = true;
jumpcount = 0;
jumpSpeed = 22;
} // end if
if (Key.isDown(38))
{
jumpcount = jumpcount + 1;
this.gotoAndStop(3);
} // end if
if (jumpcount > maxjump && jumpSpeed > -2)
{
jumpSpeed = jumpSpeed - 2;
} // end if
if (Key.isDown(32))
{
} // end if
}
onClipEvent (keyUp)
{
this.gotoAndStop(1);
_root.jumpp.gotoAndStop(1);
_root.shoot.gotoAndStop(1);
}
onClipEvent (enterFrame)
{
if (this._x >= 545)
{
this._x = 540;
} // end if
if (this._x <= 10)
{
this._x = 15;
} // end if
}