Score based on Drifting

Get help using Construct 2

Post » Mon May 04, 2015 12:17 pm

Hello, Everyone.
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 :mrgreen:
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
B
6
S
1
Posts: 18
Reputation: 343

Post » Mon May 04, 2015 1:49 pm

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

But I'm not sure if these conditions are the ones you are aiming for..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon May 04, 2015 10:07 pm

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.

Pic:
https://drive.google.com/open?id=0Bx-ufu2WID53ODhMcWRrbWo3SGc
Last edited by chrisinfinger on Mon Sep 05, 2016 3:33 pm, edited 2 times in total.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Mon May 04, 2015 10:45 pm

Why would you need the extra global variables for that?

Image
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue May 05, 2015 5:47 am

My wife was yelling at me to come downstairs and take the trash out.. I didn't have time to think it through logically. :P
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Thu May 14, 2015 12:25 pm

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.

Thank you
B
6
S
1
Posts: 18
Reputation: 343

Post » Thu May 14, 2015 12:48 pm

That would consist of adding another condition

car.angle is not within 10 degrees of car.car.movingangle

or something similar.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 14, 2015 1:19 pm

QUOTE: That would consist of adding another condition
car.angle is not within 10 degrees of car.car.movingangle
or something similar.

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...

--
B
6
S
1
Posts: 18
Reputation: 343

Post » Thu May 14, 2015 1:41 pm

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 14, 2015 2:08 pm

I works perfectly, LittleStain!

Thank you all, again.


--
B
6
S
1
Posts: 18
Reputation: 343


Return to How do I....?

Who is online

Users browsing this forum: KSLR and 40 guests