How do I stop the messages from overlapping?

0 favourites
  • 3 posts
  • C3/Mobile

    When a sprite is destroyed, a message appears at the top of the screen that reads 'Destroyed' or 'Blasts +30' or something else, for just a moment - that all works.

    Sometimes the sprites overlap or are very close and are destroyed at the same time, which is good for the player, but when this happens the messages at the top overlap - that's not good. All the messages use the same text box.

    This is what it looks like:

    {The background is black because the camera isn't on}

    How do I keep the messages from overlapping?

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of showing the text right away, you can try pushing values into an array when a message is shown.

    Then at the end of the event sheet, you loop through the array showing all the messages neatly stacked, you would need multiple text instances to do this and a little calculation to figure out the position of each text instance.

    If you want to keep everything in the same text instance, you can loop the array and combine all the messages.

    Don't forget to clear the array after showing all the messages!

  • Diego is spot on, you could pop the array front (delete 1st, then display second, etc.)

    A couple other options:

    1. Destroy the first one when creating the new.

    2. Opacity lowered for old (or both).

    That's the nice part of programming, whatever you want is perfect.

    Just adding, recall the old super mario brothers. It spawned messages at point x,y then move up all the old with a fade. Was kinda neat.

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