Efficient?

onClipEvent(enterFrame) {
//y for horizontal walls
if(_root.wall1.hitTest(_root.player)){
setProperty(_root.player, _y, vLastY);
} else if(_root.wall2.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall3.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall4.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.wall5.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate1.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate2.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.gate3.hitTest(_root.player)) {
setProperty(_root.player, _y, vLastY);
} else if(_root.key1.hitTest(_root.player)) {
_root.gate1.gotoAndPlay(2);
_root.key1.gotoAndPlay(2);
} else if(_root.key2.hitTest(_root.player)) {
_root.gate2.gotoAndPlay(2);
_root.key2.gotoAndPlay(2);
} else if(_root.key3.hitTest(_root.player)) {
_root.gate3.gotoAndPlay(2);
_root.key3.gotoAndPlay(2);
} else if(_root.endlevel.hitTest(_root.player)) {
_root.gotoAndPlay(2);
}

// x for vert walls
if(_root.wallA.hitTest(_root.player)) {
	setProperty(_root.player, _x, vLastX);
} else if(_root.wallB.hitTest(_root.player)) {
	setProperty(_root.player, _x, vLastX);
} else if(_root.wallC.hitTest(_root.player)) {
	setProperty(_root.player, _x, vLastX); 
} else if(_root.wallD.hitTest(_root.player)) {
	setProperty(_root.player, _x, vLastX);
} 
							
	
		
if(Key.isDown(38)) {
	//38 is down arrow
vlastY = getProperty(_root.player, _y);
vLocationY = getProperty(_root.player, _y);
setProperty (_root.player, _y, vLocationY -10);

}
if(key.isDown(40)) {
//40 is up arrow)
vlastY = getProperty(_root.player, _y);
vLocationY = getProperty(_root.player, _y)
setProperty (_root.player, _y, vLocationY +10);
}
if(key.isDown(37)) {
//37 is left arrow
vLastX = getProperty(_root.player, _x);
vLocationX = getProperty(_root.player, _x)
setProperty (_root.player, _x, vLocationX -10);
}

if(key.isDown(39)) {
	//39 is right arrow
vLastX = getProperty(_root.player, _x);
vLocationX = getProperty(_root.player, _x)
setProperty (_root.player, _x, vLocationX +10);
}

}

that is the code i am using for this maze type game i am trying to make, and everything works great, but what i’m wondering is, if thats how you have to do it? so if i have 60 maze walls, i’m going to have to write 1 if statement and 59 else statements?

seems like you could create one object that contained all of the walls in a “semi-transparent layer”

Like just draw the maze out completely, make the spaces in between the walls transparent -

and then have your “mouse” or thing “travelling the maze” programmed via a hitTest function to react or call another function when it collides with that “maze overlay movie clip”

But there are others here with more knowledge in AS than I.

Be patient. Someone will be with you shortly hehe.

okay, i’m not completely sure what you mean.