[solved (counting)] Is this a collission problem?

I tried the basic platformer tutorial and found a slightly anoying problem.

If you collect 2 coins at the same time, for example by jumping on it, the coins get destroyed but you only get points for 1 of the coins.
This Problem occurs on both, the native and the web platform.
You can try this by playing the advanced example from the tutorial. 1 Coin is worth 100 Points, but if you collect 2 at the same time you only get 100 points.

The events I used, are exactly like in the tutorial.

for the coins:

for the score:

things I tried:

  • I tried to add 100 to the score befor destroying the coin object. That brought no changes to the problem.

Is this a collision problem?
Is this somthing that can be fixed or do I need to work arround that “bug”?
That is no hate, I just want to know. I like this software : )

That’s not a bug.

The condition is reached because the player collides the coins. So, Game Develop knows that these 2 coins are in collision with the player.
The first action deletes them, then the sound is played. Finally 100 points are added to the score. But, as you see, that’s executed only once (as GD destroyes both coins at the same moment).

To counter that, you should use :

Count(Coin) * 100

instead of 100. In fact, Count(Coin) returns the number of Coins that are processed by the event : if two coins validates the conditions, Count(Coin) will return 2.

Note : Indeed, this behavior happens only when you collide both coins at the same moment. If you collide the first of the two coins in one frame, the first will get deleted and GD will add 100 to the score. Then, next frame, when your player finally collides the second one, the same actions will be repeated (and +100 to the score).

I would have used “for each object”, so 100 would have been counted for each object in collision.

In that case, use “For each” as a sub event of this one and put the actions in it (except the sound).
(it will work if you use directly a “For each” event but it will test all the coins inefficiently).

Thank you very much.

The count(coin) * 100 method solved the Problem.
Thank you for the explanation, I am always interessted in the mechanics.

When you see that behavior first, you find it strange.
But with some logical knowledge (on the GD works), we can understand that it’s totally normal and “logical”. :wink: