|
Post by UMS Author Lava on Feb 20, 2007 16:46:02 GMT -5
Anyways, I'm trying to make an RPG platformer in Flash, and I need help with the character base:
onClipEvent (load) { jump = 0; jumping = false; falling = false; } onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { this._x -= 7; this._xscale = -100; this.gotoAndStop(2); } else if (Key.isDown(Key.RIGHT)) { this._x += 7; this._xscale = 100; this.gotoAndStop(2); } else { this.gotoAndStop(1); } } onClipEvent (enterFrame) { if (Key.isDown(Key.SPACE) && !jumping) { jump = 36; jumping = true; } if (jumping == true) { this.gotoAndStop(3); jump -= 2; if (jump<=-15) { jump = -15; } this._y -= jump; } if (hitTest(_root.ground)) { jump = 0; jumping = false; } } onClipEvent (enterFrame) { this._y += 16; if (hitTest(_root.ground)) { this._y -= 16; } }
Frame 1 has the Stand movie clip, Frame 2 has Walk, and Frame 3 has a Jump mc. Any suggestions? 'Cuz the movie clips aren't moving.
|
|
|
Post by nate on Feb 26, 2007 10:53:43 GMT -5
The reason they arent moving because you need to add Play(); below if (Key.isDown(Key.LEFT)) { and (Key.isDown(Key.RIGHT)) { or else the movie clip wont serve you a animation. tell me if thats not working.
Oh, and one more thing. Add Play(); below onClipEvent (enterFrame) { if (Key.isDown(Key.SPACE) && !jumping) {
but I dunno if it will work for the jumping. A while ago I tried making a Platformer. it suceeded, but the jumping animation worked not very good. So I left the jump and kept the walking.
|
|