Make a message show up when overlapping/colliding object?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • How to make a message/text show up when overlapping/colliding object?

    Like:

    In platform game, there is a "sign" object which will show up a message if you walk to it.

    That's what I meant.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are a couple of ways. But I think the best one would be to have just one generic message object(s). I imagine you would want a speech bubble or box or something and on top of it a spritefont or regular text object that from this point on I will simply call a label. Alternatively if you use sprite fonts and have one with outlines (to make it more readable against differently coloured backgrounds) you would need the label alone (typical floating text like in lucas arts adventure games of old).

    Now these objects (label and message box) should be invisible at layout start. What you would do is move these to the desired position (above the sign or player, I recommend using an image point for this) on collision, changing the text to the desired message and then making both objects visible.

    The message itself should be stored in each sign object as text variable. That way when the collision event with the sign happens, it would pick the right text (so long as the player does not overlap or collide with multiple signs simultaneously).

    All you would need to do now is to create an event as below:

    Conditions:

    On Player collision with Sign

    Actions:

    Move Label to sign image point (1)

    Set Label text to Sign.text

    Set Label visible

    Of course now you also need a way to make the message invisible either when the player stops colliding with it or after a given time (possibly both). For the former a simple inverted "player overlaps sign" event would be enough, as it would trigger when the player is not overlapping the sign. For the latter a timer and/or fade behaviour can be used (but then you need to remember to set opactity to 100% in addition to making the Label object visible when moving the sign).

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