I am trying to make a game in flash.
I have a ball which has to be moved inside the wall only. I am moving the ball with the keyboard arrows tht works fine. But i dont want the ball to go beyond the wall.How do i do this.
I am trying to make a game in flash.
I have a ball which has to be moved inside the wall only. I am moving the ball with the keyboard arrows tht works fine. But i dont want the ball to go beyond the wall.How do i do this.
Download the scrolling car game from my site - which has movement based on restriction. If I understand you question it would be something like this:
onClipEvent (load) {
carSpeed = 14;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT) && this._x<500) {
this._x += carSpeed;
} else if (Key.isDown(Key.LEFT) && this._x>200) {
this._x -= carSpeed;
}
}
Change the x boundaries to what you want. Add in y boundaries if needed.
:: Copyright KIRUPA 2024 //--