CTT_Mustapha
12-27-2002, 08:00 PM
Hi.
I've been having a bit of a problem trying to make a simple game in Flash MX. I want it so that when a movie clip touches another movie clip, it stops like a wall. I've pasted my code below. I know that my method of detecting and stopping the movie clip is incorrect but that was just an idea that didn't seem to work.
onClipEvent (load) {
speed = 5;
this._x = 100;
this._y = 100;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.LEFT)) {
this._x -= speed;
}
if (Key.isDown (Key.RIGHT)) {
this._x += speed;
}
if (Key.isDown (Key.UP)) {
this._y -= speed;
}
if (Key.isDown (Key.DOWN)) {
this._y += speed;
}
if (this.hitTest (413.2, 208.1, true)) {
this._x -= 100;
}
}
Thanks
:)
I've been having a bit of a problem trying to make a simple game in Flash MX. I want it so that when a movie clip touches another movie clip, it stops like a wall. I've pasted my code below. I know that my method of detecting and stopping the movie clip is incorrect but that was just an idea that didn't seem to work.
onClipEvent (load) {
speed = 5;
this._x = 100;
this._y = 100;
}
onClipEvent (enterFrame) {
if (Key.isDown (Key.LEFT)) {
this._x -= speed;
}
if (Key.isDown (Key.RIGHT)) {
this._x += speed;
}
if (Key.isDown (Key.UP)) {
this._y -= speed;
}
if (Key.isDown (Key.DOWN)) {
this._y += speed;
}
if (this.hitTest (413.2, 208.1, true)) {
this._x -= 100;
}
}
Thanks
:)