# Have a car react to the surface it's driving on

Get help using Construct 2

### » Tue Nov 25, 2014 4:35 pm

I'm trying to create a top down rally racing game. The car is supposed to react to the type of terrain it is currently driving on, which means that driving over sand will have a greater performance penalty than driving over rocks. I have tried working with the collision and overlapping features in the event sheet, but without any luck.
I'm not a programmer, so I really don't know where to look. I also tried using instance variables, although I think they're not meant for this.

Any help or tips would be highly appreciated!

Mathijs
B
12
S
2
G
1
Posts: 34
Reputation: 741

### » Tue Nov 25, 2014 4:52 pm

Hi @Mathijs90 - Overlapping should do it.
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

### » Tue Nov 25, 2014 5:32 pm

I've tried, but I think the problem is that it has to change relatively to the original value. I've tried testing this by having the value multiply by 0.5. This is because the player will be able to install upgrades to his car, which means the original value is not always the same. Therefor it is impossible to change this value to a definite number, when the overlapping takes place.

I.e.. Say the player upgraded his car's max speed from 100 to 150. And he would then drive this car over a patch of sand. If the overlapping changes the max speed value to 50, it would be half of the original value, but only a third of the upgraded value. Therefor it would not matter to the player whether he had upgraded his max speed or not, which would kill the entire upgrading system. This is why the changes made must be relative, and not absolute.

Also the value must be restored once the car is no longer overlapping the patch of sand.

I could send you the .capx link in a PM, so you can have a better look at it.

Edit: I cannot link the file in a comment since you need at least 300 rep to be able to do this. A link through PM requires at least 500, so that won't be possible either.
Edit: Edit: Yaaay, 300 rep! Here's a dropbox link to the .capx file: https://dl.dropboxusercontent.com/u/48511605/GO4Dakar_BasicPhysics.capx
B
12
S
2
G
1
Posts: 34
Reputation: 741