Este es el archivo de ejemplo:
Esta asi:

Y con el problema queda asi:

Lo que pasa es que al chocar el personaje contra la pared el fondo se sigue moviendo dejandome el personaje fuera de vista. Asi que se me ocurrio crear un variable que si "personaje" toca "pared" movimiento del fondo es nulo. Sin embargo no me detecta la variable, estos scripts use:
En el personaje:
Código :
//variable onClipEvent (load){ var choque } //Choques: //Horizontal: onClipEvent (enterFrame) { while (_root.paredes.hitTest(_x+_width/2, _y, true)) { _x--; this._root.choque = false; } while (_root.paredes.hitTest(_x-_width/2, _y, true)) { _x++; this._root.choque = false; } } //Vertical: onClipEvent (enterFrame) { while (_root.paredes.hitTest(_x,_y+_height/2, true)) { _y--; this._root.choque = false; } while (_root.paredes.hitTest(_x,_y-_height/2, true)) { _y++; this._root.choque = false; } }
En el fondo:
Código :
onClipEvent(load){ var choque = true; } onClipEvent (enterFrame) { if (choque == true){ if (Key.isDown(Key.LEFT)){ _x += 5; } if (Key.isDown(Key.RIGHT)){ _x -= 5; } if (Key.isDown(Key.DOWN)){ _y -= 5; } if (Key.isDown(Key.UP)){ _y += 5; } } } onClipEvent (enterFrame) { if (choque == false){ if (Key.isDown(Key.LEFT)){ _x += 0; } if (Key.isDown(Key.RIGHT)){ _x -= 0; } if (Key.isDown(Key.DOWN)){ _y -= 0; } if (Key.isDown(Key.UP)){ _y += 0; }
Sera que ya que son movieclips distintos no se detectan la variable entre si?

Lo más probable es que en el personaje al variable esta mal puesta. Ya he intentado colocarla de varias formas, tanto con this como con parent. Ojala me puedan ayudar.