Well, ive been using flash for a long time but i have to say [COLOR=blue]im[/COLOR] no pro at coding. I know some stuff, but not enough for what im trying to do.
Basically, im making a little car minigame of a car in a city. This is my engine on the car:
onClipEvent(load)
{
speed =0 ;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 0.4;
}
if (Key.isDown(Key.DOWN)) {
speed -= 0.1;
}
if (Key.isDown(Key.SPACE)) {
speed /= 1.15;;
}
if (Math.abs(speed)>20) {
speed *= .7;
}
if (Key.isDown(Key.LEFT)) {
if (speed < 0.5) {
_rotation -= speed;
} else {
_rotation -= 5;
}
}
if (Key.isDown(Key.RIGHT)) {
if (speed < 0.5) {
_rotation += speed;
} else {
_rotation += 5;
}
}
speed = .98;
x = Math.sin(_rotation(Math.PI/180))speed;
y = Math.cos(_rotation(Math.PI/180))speed-1;
if (!_root.wall.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
}
Im fine with all of it but the collisions, as the car will only bounce when the [COLOR=blue]registration[/COLOR] point of the car collides with ‘wall’, so it looks all funny and that and the car goes into any thing collable half way then bounces back, and occasionally gets stuck in the wall. Reall annoying. Ive tried fixing it but whenever i remove the hittest parts the car wont even move or turn.
PLease help me so the wall collides with the car (27.7 x 13) and not the registration, i would be so gratefull.
Note i need a strong engine which works with curves aswell, and requirs me just putting the code into the car, but if i have to put it into the walls/frame i suppose its okay, but theres no way im going through every single building and that.
Also, it would be cool if:
-You could give me an engine where when reversing the steering is reversed (like irl)
-The car doesnt bounce backwards when driving at a wall at an angle, but slides against it (like irl)
Thanks. (btw, ive tried sites like emanuale fernando and that but they never work).
-SM
EDIT; id like it to be like nonoba racer, google it
also, sorry for 1 or 2 wods underlined. long stoery