Its not normal that I need help with a college assignment but this one has me truly stuck. The issue I have been having is that I want to have border around my 'room' in my game and when you go up to that wall it would stop you going any further. The issue I am having is that when I am in the middle of the boxes (inside the games walls) I can move up to the walls and go through them, however when I turn around and go back towards the inside of the box I cannot go back through. So it seems it only working one-way which is annoying. Unfortunately we have split up for Christmas break so I cannot ask my tutor for assistance.
I have tried multiple ways (multiple HitTestObject, and points etc) and tried looping through all the objects which are walls and testing each frame, however with no luck. If you could just give me a hint of where to go I would be very grateful.
Here is my detection code:
player.x = newX;
player.y = newY;
/*if(wallMovieclip.hitTestPoint(player.x, player.y, true)){
//tried this, and it didn't work.
}*/
for (var i:int=0; i<wallMovieclip.numChildren; i++){
if(wallMovieclip.getChildAt(i).hitTestObject(player)){
player.x = oldX;
player.y = oldY;
}
}
Here is also a zip of the whole thing if anyone want to have a closer look.
https://www.dropbox....u/GameFiles.zip
Thank you DIC!

New Topic/Question
Reply



MultiQuote



|