Global Variable Score problem

Get help using Construct 2

Post » Fri Aug 18, 2017 6:44 pm

Hi guys, i have a question. I have a simple game where you shoot birds and each killed bird gives you 1 point in a global variable.

I had an event:

Bullet, on collision with Bird:
- bird destroy
- bullet destroy

I tried a second the event:

Bird, on collision with Bullet - System, Add 1 to Score.

I did a preview. it was not working. In an arbitrary way, one of every 10, 15, 20 birds killed counted as a point, so i would kill more than 20 birds and have a score of 2 or 3.

I tried changing the event to:

Bird on destroyed - System, Add 1 to Score.

I did a preview and it worked perfectly.

What is the difference between those two events? how come one worked fine and the other one was pure nonsense? They seem to represent the same logical event.

Thanks
B
5
Posts: 25
Reputation: 271

Post » Sat Aug 19, 2017 10:06 pm

If the Bird on collision event was separate from after the Bullet collision event then most likely the issue was that sometimes the bird would be destroyed by the collision before the other could be triggered and very occasionally not.

The key is to put them all in one event...

Bird on collision with bullet
-bullet destroy
-System add 1 to score
-bird destroy
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
81
S
22
G
8
Posts: 664
Reputation: 10,333

Post » Tue Aug 29, 2017 2:35 pm

chrisinfinger wrote:If the Bird on collision event was separate from after the Bullet collision event then most likely the issue was that sometimes the bird would be destroyed by the collision before the other could be triggered and very occasionally not.

The key is to put them all in one event...

Bird on collision with bullet
-bullet destroy
-System add 1 to score
-bird destroy


thanks for your help chris!
B
5
Posts: 25
Reputation: 271


Return to How do I....?

Who is online

Users browsing this forum: miguelromm and 4 guests