How do I check if there are no more objects on the screen so the game can continue? SOLVED

0 favourites
  • 5 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I created a simple game that shows a total of 10 objects, objects created every 5 seconds and lasting another 5 seconds. The player needs to click on the correct objects to destroy them before the total time of 30 seconds runs out and the program stops creating new objects.

    I am using a variable to control the number of objects created, however, I cannot use the inverted on-screen event, as it does not work, to check if all objects have been destroyed and there are no more on the screen. Instead, I'm having to take the last object created (which may or may not be correct) and wait for its lifetime to then change levels. In cases where the object is the correct one, it is destroyed when clicked and the game has an empty screen until its lifespan is complete. Would anyone have a solution for this?

  • + System: Sprite.Count = 0 -> (no actions)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • + System: Sprite.Count = 0 -> (no actions)

    In this case, I cannot do this check based on the total number of objects, because if the object is not the correct one, it may stay on the screen until its lifespan ends.

    What I really needed to check is whether there is still an object on the screen or not, but the on-screen (inverted in this case) doesn't work at all. I don't know why this event exists.

  • I often use this trick:

    Object on screen : // nothing in this event
    
    Else : // your actions here
    
  • I often use this trick:

    > Object on screen : // nothing in this event
    
    Else : // your actions here
    

    Thanks. I will give it a try.

    EDITED:

    dop2000

    That worked. Thank you very much.

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