help - identifying too many sprites on screen

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • First I'd like to say thank you to everyone who has contributed to these forums and the tutorials. I wouldn't have made much progress without the help I've found in your answers to others questions and in your tutorials.

    Now on to my question:

    I have a game where you have to stop sprites before they spawn. So, if you don't act fast the sprites spawn more sprites, and those sprites spawn more sprites,etc - until the screen is jam packed with sprites in which case - game over.

    I'm trying to figure out how to have an event detect that there are too many sprites on the screen. All sprites are solid, and contained within the screen. So they are bouncing off each other, and bouncing back off another sprite, spawning endlessly.

    The sprites are all different sizes, so I can't go by numbers of sprites. I'm currently attempting to record the location of a sprite in an instance variable and every 2 seconds compare the current location to the instance variable - but it isn't working very well (possibly because the sprites are still moving, even if they are just juttering in a tight area).

    Is there a good way to test if the screen is overpopulated with sprites?


  • How about giving each sprite type/size a numeric value based on the amount of pixels the sprite occupies. Let's say small sprite (16x16px) 256, medium (32x32px) 1024, big (64x64px) 4096.

    Sprites don't have to be square - as long as you approximately know how big they are you'll be fine.

    Create a variable in the layout, each time a sprite is spawned add it's value to the variable.

    Check how big is your layout (800x600px has 480000 pixels) when the sprites occupy let's say 50% of the layout (so when the variable is equal or bigger to 240000) initiate GAME OVER.

    Experiment with how much of the layout you want to be occupied both game-play and performance-wise.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. I will try that and report back! :o)

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