Why is my score only incrementing once?

0 favourites
  • 4 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • I am checking if my dagger overlaps a playing card, and the dagger is overlapping two cards. So they both turn green, but the score only increments by 1? I would have thought the two overlap tests which prove positive must mean there were multiple iterations of the check in the event, and it would increment twice.

    I need to know, (1) how to stop the overlap test from processing multiple overlaps and terminating after the first overlap find - so I cant hit two cards with one throw....or (2) how to detect 2 overlaps, but get the score to incremement appropriately. This has undermined somewhat my understanding of the event system, but I am sure someone here will be able to explain.

    The issue is, my end level condition doesnt get triggered as the number of cards hit, has to equal the number of cards generated, and in this state - the condition is never met, as the double strike is only incrementing the score by 1, not 2 - so I will never reach the end level condition.

  • I would say try a sub event below the "overlapping" event, saying pick top instance for example or pick random instance. It will retain only one.

    I had exactly the same issue with my solitaire game :

    youtu.be/E1zqEGLeCyI

    If I overlap a card, I can only pick the top one. It's handled on object clicked, but same thing I presume with overlapping.

    To increment the score correctly you will probably be best off using a for each loop inside the event as a sub event. But BEFORE you do the pick top instance otherwise you will be left with only one, and the score will increment only 1.

    So on overlap

    for each

    increment 1

    pick top

    do something with top instance

    Let me know if that worked for you.

  • Thanks, this seems to be working to only allow a single item to be selected.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can also use the PickedCount expression if you want more control over what happens when there are x objects overlapping.

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