Código:
myMap = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
Código:
else if(estat == RIGHT){
if(Key.isDown(Key.UP)){
gotoAndPlay("UP")
estat = UP
}
else if(Key.isDown(Key.LEFT)){
gotoAndPlay("LEFT")
estat = LEFT
}
else if(Key.isDown(Key.DOWN)){
gotoAndPlay("DOWN")
estat = DOWN
}
else if(Key.isDown(Key.RIGHT)){
x=this._x/30
y=this._y/30
trace(x)
if((myMap[x+1][y])==0){
this._x += speed
}else if((myMap[x+1][y])!=0){
}
if(Key.isDown(Key.UP)){
gotoAndPlay("D_UPRIGHT")
estat = D_UPRIGHT
}
else if(Key.isDown(Key.DOWN)){
gotoAndPlay("D_DOWNRIGHT")
estat = D_DOWNRIGHT
}
else if(Key.isDown(Key.SPACE)){
_root.attack1r.duplicateMovieClip("attack1r"+depth_laser,depth_laser)
_root["attack1r"+depth_laser]._x = this._x + 100
_root["attack1r"+depth_laser]._y = this._y
depth_laser++
}
}
else{
gotoAndPlay("RRIGHT")
estat = RRIGHT
}
}
gracias