Max speed - Decrement

For questions about using Classic.

Post » Wed Jan 13, 2010 5:31 pm

On a collision to a wall with the Car Behavior, I wanted to lower the Max Speed on every collision.

I tried On Collision between Car and Wall:
Sprite[Car].MaxSpeed = Sprite[Car].MaxSpeed - 50

Any help on how to make the car go slower with each collision?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Wed Jan 13, 2010 6:33 pm

Well your method is working ok. Just remember to use "On Bounce" and set wall attribute to "Solid"
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Wed Jan 13, 2010 9:40 pm

I have bounce to stop and wall to sold but i am not getting a decremented slowdown after each hit
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Wed Jan 13, 2010 10:29 pm

Try the Car Behavior's "On Bounce" condition instead of On Collision.

http://dl.dropbox.com/u/529356/car%20crash.cap

On Collision checks for overlap between two sprites. It's basically the same as this:

[code:1wnpf8de]
+ Car is overlapping Wall
+ Trigger Once
-> Do stuff
[/code:1wnpf8de]

Since the car is bouncing away from the wall before it's overlapping then you will never get On Collision to trigger.

On Collision has been modified for other behaviors in the past though. For instance, you can use On Collision with Physics objects to detect collision even though they don't overlap either. You might want to make a feature request to have Car recognize On Collision in the same way, if it's important to you somehow. Otherwise just use On Bounce.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 13, 2010 11:27 pm

OK I got this to work with:
Car[Car].MaxSpeed -50

The problem is I was using stop first (because I do not like the large bounce back), and with the car stopped touching the wall It subtracted the -50 untill I was unable to move

I with bounce did not push you so far back. Is there a way to edit the amount of bounce?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest