I am trying to define the play area of my game and I have detailed the code as follows but it doesn’t want to work, my character keeps moving outwith the area when I test the game, can anyone help a novice?
stop();
Mouse.hide();
geisha.gotoAndStop(1);
geisha.move = {x:0, y:0};
geisha.speed = 5;
rightWall = 550;
leftWall = 0;
topWall = 0;
bottomWall = 400;
geishaHeight = 119.4;
geishaWidth = 44.5;
geisha.onEnterFrame = function(){
this.move.x = Key.isDown(Key.RIGHT) - Key.isDown(Key.LEFT);
this.move.y = Key.isDown(Key.DOWN) - Key.isDown(Key.UP);
if (this.move.x || this.move.y){
this._x += this.move.x * this.speed;
this._y += this.move.y * this.speed;
}
}