|
Flash制作物体弹跳电脑游戏(8) place_brick.gotoAndStop(level[y][x]); } } } _root.attachMovie("player", "player", _root.getNextHighestDepth(), {_x:40, _y:40}); player.onEnterFrame = function() { if (Key.isDown(Key.LEFT)) { if (jump_walk or can_jump) { xspeed = -walk_speed; } } if (Key.isDown(Key.RIGHT)) { if (jump_walk or can_jump) { xspeed = walk_speed; } } if (Key.isDown(Key.SPACE) and can_jump) { yspeed -= jump_power; can_jump = false; } yspeed += gravity; if (yspeed>max_yspeed) { yspeed = max_yspeed; } while (_root.lev.hitTest(this._x, this._y+this._height/2-1+yspeed, true)) { yspeed--; can_jump = true; } while (_root.lev.hitTest(this._x-this._width/2+1+xspeed, this._y, true)) { xspeed++; } while (_root.lev.hitTest(this._x+this._width/2-1+xspeed, this._y, true)) { xspeed--; } while (_root.lev.hitTest(this._x, this._y-this._height/2+1+yspeed, true)) { yspeed++;
|