Thursday 30 April 2009

Added Features: moving platforms

Moving Platforms


When trying to make moving platforms I ran into a problem the platform would move but the character would not go with it. I fixed this problem by turning the moving platform into a moving springboard that propelled the character a small height giving the player time in the air to move the character along with the moving platform.

Code =

var movspringHeight:Number = 11;
// how high you jump on movingspring

if (_root.movingspring.hitTest(_x, _y+3, true)) {
// Jump
grav = -movspringHeight;
_y -= 4;
this.gotoAndStop(4);
}

No comments: