Once again I need to borrow your knowledge to solve a peculiar problem...
I'm creating a top down racing game with a "Tokyo drift" theme going on
So far, I'm just using a car behavior for the "player" and some global values for the damage on the car when it hits something. Right now i'm working around the idea of getting points when you drift, very similar of what happens in the drifting challenges on the Need For Speed: Underground series.
I've tried using the angle of the car but, on a top down racer you can just get points by pointing the car to the right angle without drifting - erase this idea.
I've also tried creating little sprites on the front and back of the car and use the angle between them as a comparable value to use but it just results on the same issue of before.
What's the best way for me to achieve this drift score mechanic on C2?
Thank you all in advance
Fisrt you need to know what you consider drifting..
Then you need to set up conditions for when this is happening..
So I guess it would be something like:
Car is moving
Car speed is > 10
sytem compare two values car.angle is not the same as car.car.movingangle
add 1 to drift
add 1 to drift
But I'm not sure if these conditions are the ones you are aiming for..
Here is a very rough code that adds to a score variable while the car object is moving but not facing forward.. aka drifting.
You would need to tweak it to get your exact feel though. I used globals for simplicity.
Why would you need the extra global variables for that?
My wife was yelling at me to come downstairs and take the trash out.. I didn't have time to think it through logically.
Develop games in your browser. Powerful, performant & highly capable.
First of all, thank you all so much for the help. Both solution seem to work brilliantly when it comes to adding score when it drifts.
My issue right now is that i need to increase the value of the angle so that the drift score doesn't go up as soon as you steer the car. In another words, the drift score only goes up if the drift angle is above a certain value.
I'm gonna do some testing with some calculations but, in the meantime, if you guys any valuable info, it's always more than welcome.
That would consist of adding another condition
car.angle is not within 10 degrees of car.car.movingangle
or something similar.
QUOTE: That would consist of adding another condition
That's exactly what I've been trying to do but most likely I'm not applying the right formula, since I'm still a bit of a noob...
Right click the event
choose - Add another condition
System is within angle : angle1 = car.angle, within = 10, angle2 = car.car.movingangle
right click condition
choose - invert
I works perfectly, LittleStain!
Thank you all, again.