Download

Counting Collisions

Hello,

I’m looking to make a trampoline.

I’ve got a basic player launcher working, launching the player x each time there is a collision.

What I’m looking for is a way to count the collisions with the launcher so I can use the collision count as a multiplier for the launch height.

So, when colliding with the launcher:

First time velocity = x
Second velocity = x2
Third velocity = x
4

Seems pretty simple, but I cant find any way to count the number of times the launcher has been hit, anyone fancy pointing me in the right direction?

Who’s doing the counting? The trampoline itself or the entity that hopped on it?

If I, as a player, bounce 5 times to get to 10m (2m per booiiinnng, let’s say), whatever else that comes into contact with it gets catapulted to 2 or 12 meters? Perhaps it’s irrelevant here but may be worth considering.


One way or another, keeping the count can be done like so:

image

The variable increases by 1 every time the collision is detected.

Also, consider the following:

Rather than counting, you multiply player’s velocity by 125%