Wednesday 29 April 2009

Added features

Fans





I wanted to make platforms that you could jump through and then land on I managed to make them but when the character was on them he wouldn't walk on them he'd just sort of float above them playing his idle animation so I added a bit of code to make him play the falling animation and changed the art of the platforms into fans. The last paragraph of code makes adds the ability to jump while on a fan.

Code:

var platformHeight:Number=0
//platform resistance

if (_root.platform.hitTest(_x, _y, true)) {
// Jump
grav = -platformHeight;
_y -= 1;
this.gotoAndStop();
}

if (Key.isDown(65) && _root.platform.hitTest(_x, _y, true)) {
// Jump
grav = -jumpHeight;
_y -= 4;
this.gotoAndStop(2);
}

No comments: