PDA

View Full Version : [AS2] hitTest Problem


TastyTeo
06-30-2009, 03:47 PM
onClipEvent(enterFrame){
if(this.hitTest(_root.wall1)){
_root.gotoAndStop(2);
}
if(Key.isDown(Key.RIGHT)){
this._x += 3;
}
if(Key.isDown(Key.LEFT)){
this._x -= 3;
}
if(Key.isDown(Key.UP)){
this._y -= 3;
}
if(Key.isDown(Key.DOWN)){
this._y += 3;
}
Can you correct it?
I Want to make a character movement(already made) and when hit wall1 goto play frame 2

crosshair
06-30-2009, 04:19 PM
That code is right...

TastyTeo
06-30-2009, 07:19 PM
IT ISN'T !!! it says "{" expected

rrh
06-30-2009, 07:32 PM
It says { expected and not } expected? Because to me you look like you're missing the latter not the former.

TastyTeo
06-30-2009, 07:45 PM
I Don't know, may you can remake the actionscript?

pradvan
06-30-2009, 09:23 PM
onClipEvent(enterFrame){
if(this.hitTest(_root.wall1)){
_root.gotoAndStop(2);
}

if(Key.isDown(Key.RIGHT)){
this._x += 3;
}
if(Key.isDown(Key.LEFT)){
this._x -= 3;
}
if(Key.isDown(Key.UP)){
this._y -= 3;
}
if(Key.isDown(Key.DOWN)){
this._y += 3;
}
}