This content has been marked as final. Show 5 replies
use a loop that continually checks if you character is going to contact (use a hitTest() ) an object.
I'm relatively new to Flash, I do understan hiTest but I don't no how to use a loop.
using a loop in computer programming is fundamental. loops allow you to execute code repeatedly (usually changing one or more parameters with each loop iteration) in a succinct manner.
now, you probably are already using a loop to repeatededly check for a user's keyboard input to determine whether you character should walk left or right, up or down. in that loop you should execute another loop that checks if contact is made with an object.
in your situation of a character (with instance name, say characterMC) and walls (with instance name, say wall1,wall2,...,wallN), you could use:
Yea that's the problem, I don't want that, for example: if (condition) _x -= 10 because my character is always centered. What do you suggest to put in "do sumthin, ur about to hit a wall"?
i don't know what you're seeing that would cause you to say, "Yea, that's the problem. ..."
if a positive hitTest() will result from the movement of your walls, don't allow that movement. if you want your character to rebound, then code that rebound (of the walls).