wall hitTestObject but with multiple walls
im doing a simple rpg game for a programming course held in my college and i have an issue with the walls
so far this is what i figured out to make character not be able to walk on walls
Code:
function gameLoop(loopEvent: Event): void {
//////////links movement
if (rightPressed == true) {
if (linkMc.x < 1200) {
linkMc.x += 10
} else if (overworldMc.x > -4310) {
overworldMc.x -= 10;
}
linkMc.gotoAndStop("walk right frame");
} else if (leftPressed == true) {
if (linkMc.x > 570) {
linkMc.x -= 10
} else if (overworldMc.x < 3000) {
overworldMc.x += 10;
}
linkMc.gotoAndStop("walk left frame");
} else if (downPressed) {
if (linkMc.y < 525) {
linkMc.y += 10
} else if (overworldMc.y > -2232) {
overworldMc.y -= 10;
}
linkMc.gotoAndStop("walk front frame");
} else if (upPressed) {
if(!linkMc.hitTestObject(overworldMc.wallMc)){
if (linkMc.y > 300) {
linkMc.y -= 10
} else if (overworldMc.y < 0) {
overworldMc.y += 10;
}
}
as you can see in the last one i made an objects called wallMc thats going to be transparent, and it works well to stop the chara from walking forward but i need multiple of these and when i put them all in one object the character is kind of ''inside'' of the symbol so she just has no ability to walk forward, in what way could i set it up so that i have multiple of these?