How do I add points to score in real-time without looping?

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • There are many "Bug" objects on the screen at the same time. When one of the "Bug" objects overlaps one of the "Wall" objects, 100 points should be added to the Points display in real-time. However, in my code, it continuously adds 100 points instead of just one time. I tried using a Trigger Once condition (see the second code). Thank you for your help!

    This code continuously adds 100 points:


    This code adds 100 points on the first overlap, but then continuously adds 100 points on other overlaps:


  • Try removing "For each" and leave trigger once while true - see if that helps.

  • Use a collision event, not overlapping.

    And for less code, put your wall objects in a family.

  • Thank you for your help. I tried your suggestions along with many other things, but it's still not working exactly how I want it.

    The points are being displayed, but they are cumulative, and I don't want that. For example, if there are three collisions on the screen, the points should be 300, and then later if there are two collisions on the screen, the points should be 200, not 500, which is what is happening now.

    How do I make my points not cumulative?


  • Changing the on collision to to is overlapping then maybe a Else event that sets it back when not overlapping

  • You need to reset global variable points then, you are now adding points to your overall number.

    You can set something like "PointsPasser" as global variable.

    PointsPasser will reset every tick, so it will pass the points on to main point global variable, set text to score and reset to "0" so it can show points from new collisions.

  • If you could provide capx I might be able to help you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you could provide capx I might be able to help you

    Here's a simple capx file.

    All I want is when you move the Bug object (move it with arrow keys) over the Wall object, the Points are 100. When you move it off the wall, the Points go back to 0.

    Thank you for your time and help!


  • DoomEyes you mean like this if not give me good explanation

  • DoomEyes could be like this

  • DoomEyes could be like this

    Thank you for taking the time to do these demos. They are both partially correct. When the Bug object is not colliding with the wall, the points should reset to 0. That's the part I am having trouble with. Do you know how to do that? Thank you.

  • ok I will see

  • This is one way to do it.

  • This is one way to do it.

    Thanks for trying, but it's still not exactly what I want. If you don't have time for this, I understand, but the screens I pasted below are what I am trying to do. Thank you.



  • I do not understand how you want this? is what you want

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