Coin gives twice it's correct score

This forum is currently in read-only mode.
From the Asset Store
It's here!
$4.95 USD
Creepy and nasty horror track. It's terrifying from the beginning till the end. Goosebumps guaranteed
  • I am working on a simple platformer and at first the coins/score worked fine, but all of a sudden each coin started giving 20 points instead of 10. I notice that it quickly changes from 0 to 10 to 20 when I pick up the first coin (if I write it a way that makes the score changing slower). This means it is adding 10 points TWICE for each coin.

    I have this for the score/coin system:

    Always - Score: Set text to PlayerModel.Value('Score')

    On Collision between PlayerModel and GoldCoin - GoldCoin Destroy, PlayerModel: Add 10 to 'Score'

    I have tried a lot of different combinations of things, including Is Overlapping, but no matter what I do, it always gives 10 points twice. I even made a new object to replace the coin, but it doesn't work either.

    =/ Help please!

    Edit: For my level I am using Included Event Sheets and a seperate event sheet for some stuff. When I put that event on the linked event sheet, it works right! Does that mean there's something wrong with the event sheet?

  • strange, if its On Collision it should work, specially if you're destroying.

    Make sure you're not also adding 10 elsewhere

    you could post the .cap file so someone can take a look at it

  • Can you post a .cap showing this happening?

  • Do you have a duplicate event somewhere? Have you tried adding a "Trigger Once While True" to the event?

    A .cap would help especially since you said it worked fine at one point.

  • Have you by any chance accidentally placed two coins right on top of each other?

    Also, delete every coin except one, then run the debugger. See if it only shows one instance in the debugger or if there is more than one instance.

  • Actually, if I change the coin value to 5, it gives 5 points twice. Even if I disable every other event in that event sheet, it still does it. If I put that command on another included event sheet, it starts working correctly...

    Edit: I already checked for multiple coins. I had even created a whole new object to perform the same thing and it had the same problem.

  • I found the problem! I had two Event Sheets included:

    Color Select Event Sheet

    and

    Main Event Sheet

    The problem was that Color Select Event Sheet INCLUDED the Main Event Sheet too. So it was running the event sheet twice! It worked fine at first until I started testing something in the Color Select Event Sheet and therefore Included the Main Event Sheet in it for the testing.

    BTW, I found this by randomly deleting things...

    Edit: So even if I tell an Event Sheet to trigger something only once (which I tried too), but load the same Event Sheet twice (unknowingly in this case), it will trigger the same event twice.

    I wonder if this would happen if I used Inclue Even Sheet twice in the same layout, or only if the second Include was in another Included sheet. Interesting...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I found the problem! I had two Event Sheets included:

    Color Select Event Sheet

    and

    Main Event Sheet

    The problem was that Color Select Event Sheet INCLUDED the Main Event Sheet too. So it was running the event sheet twice!

    Ah, I had a feeling it was something simple like that . Glad you got it all sorted.

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