好久没玩flash
抓紧时间操练了一把,用下面代码作了一个粉简单的坦克控制:)
PLAIN TEXT
ACTIONSCRIPT:
class Move extends MovieClip {
private var speed = 3;
private var xMin = 0;
private var yMin = 0;
private var xMax = 400;
private var yMax = 400;
public function onLoad(){
Key.addListener(this);
this.xMin += this._width/2;
this.xMax -= this._width/2;
this.yMin += this._height/2;
this.yMax -= this._height/2;
}
public function onEnterFrame(){
if( this._x <this.xMin ){
this._x = this.xMin;
}
if( this._x> this.xMax ){
[...]