Hi all,
i have a problem with my car racing game I am making.
It is programmed with AS3 and I found a lot of resources on the internet.
But now I am stick with a problem.
I’ve builded a hitTestObject in my script. If the the green/grass has been hit the car slows down.
It does work, but not the way I wan’t.
The car already slows down when it hits the movieclip(the green grass) and thats not what I want.
I want to let the car slow down when it hits the green/grass which is in the movieclip.
I got a snip of code which I am working on now and I tried some things, but it only gives me more difficulties.
This is my code:
if (green.hitTestObject(racecar)) {
speed = 2;
}
I am trying to re-make a tutorial which is in as2 and which has the following collision code
//check for collisions
if (_root.terrain.hitTest(this["lpx"+who], this["lpy"+who], true)) {
_root["car"+who]._rotation += 5;
this["speed"+who] *= 0.85;
}
if (_root.terrain.hitTest(this["rpx"+who], this["rpy"+who], true)) {
_root["car"+who]._rotation -= 5;
this["speed"+who] *= 0.85;
}
if (_root.terrain.hitTest(this["fpx"+who], this["fpy"+who], true)) {
this["speed"+who] = -1;
}
if (_root.terrain.hitTest(this["bpx"+who], this["bpy"+who], true)) {
this["speed"+who] = 1;
}
He build it on a different way, so it also traces which way the carthe hits the grass.
Which I don’t need to know yet as I am programming the very basic yet and just want to let the car slow down in a simple way.
The more advanced programming will come later when I got the most important basics for my game.
Is there anyone who can help me with the issue? Or has some tips for me to work on, tutorial on internet or library for more help?
Thanks,
Mr Kplop