我正在尝试制作一个传送游戏,而我的角色需要有一些速度和重力,有人知道我需要多少总和才能完成这个吗?
到目前为止,这是我的代码:
var char = this.addChild(new Char());
char.width = 20;
char.height = 20;
char.x = startPos.x; //startPos is an invisible movieclip that I can move around to make the starting position
char.y = startPos.y; // accurate
var vx:Number = 0;
var vt:Number = 0;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
function keyDownHandler (e:KeyboardEvent):void {
switch (e.keyCode) {
case Keyboard.UP:
char.y = char.y - 5
}
}