# Hittest for 'walls' within Rotation Based Navigation?

Hi, my name is Ody…:?)

…but really… I just started on creating a new flashgame. I used to create games mainly based on clickable buttons… but now I would realy like to embed one more in to scripting.
In this game my character is using rotation based navigation I took from flash examples and altered.

The movement part now looks something like this:

``````
// declare and set initial variables
thrust = 2;
decay = 0.00;
maxSpeed = 8.0;
}
onClipEvent (enterFrame) {
// rotate right or left
if (Key.isDown(Key.RIGHT)) {
_rotation += 9;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 9;
}
//
//
if (Key.isDown(Key.UP)) {
// calculate speed and trajectory based on rotation
xSpeed += thrust*Math.sin(_rotation*(Math.PI/180));
ySpeed += thrust*Math.cos(_rotation*(Math.PI/180));

} else if (Key.isDown(Key.DOWN)) {
// calculate speed and trajectory based on rotation
xSpeed -= thrust*Math.sin(_rotation*(Math.PI/180))/2;
ySpeed -= thrust*Math.cos(_rotation*(Math.PI/180))/2;

} else {
// deccelerate when Up Arrow key is released
xSpeed *= decay;
ySpeed *= decay;

}
//
// maintain speed limit
speed = Math.sqrt((xSpeed*xSpeed)+(ySpeed*ySpeed));
if (speed>maxSpeed) {
xSpeed *= maxSpeed/speed;
ySpeed *= maxSpeed/speed;
}
//
// move beetle based on calculations above
_y -= ySpeed;
_x += xSpeed;
}

``````

[SIZE=1]As you can maybe see it not perfect, yet. For example I still have to put in a different way of walking backwards. :block:[/SIZE]

My main concern is how to create walls? (/not permit diferend characters from walking through each another, and ‘objects’.)

I would like to use “hittest” on surtent Instances to do this. I know how to do that, but can’t seem to think of a code that sets up a “wall”.
I already did some hittest experiments, creating things that set up:
moving floors,
sticky floors,
icey floors
kill-all-movement floors,
dubbel-your-speed floors,
magnetic floors,
turn-contols floor,
the normal-agian floors.

It’s just in case of a wall (don’t-walk-here-but-against-it) I can’t seem to figger out.
If someone could point me in the right direction, that would really mean a lot to me.

btw this is my First Post @ kirupaForum. :geek: