Global Variable Score problem

0 favourites
  • 3 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)