How do I create tooltips?

0 favourites
  • 8 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I've been trying to figure out the best way to create a tooltip system when a player is overlapping over an item.

    What I've been doing is this:

    Every Tick - Set tooltip position to -999, -999

    if Player is Overlapping object, set tooltip position to ObjectXY.

    In theory, this does work, but I wonder if there's an easier way to do it where I don't have to set it every tick.

    Any help is greatly appreciated!

  • Well you could use an inverted if player is overlapping object with a trigger once, but yeah every tick shouldn't be a problem anyway for this.

  • - that just ends up being double the amount of collision checks. And I think if the player picks up an item and there is no other item, the tooltip will remain forever because it’s checking if it’s NOT overlapping an object that doesn’t exist.

  • Ah right I just imagined it was a group of objects in a family because you can use the family.

  • - yeah, that would make sense if it was.

    I think part of the problem (looking at my code again) isn't so much the setting of the position every tick, but calling a function that sets the text for multiple spritefonts, image animation and frames, etc.

    I know there's a good way to do it, it's just everytime I touch trigger once, things stop working properly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any other ideas?

  • hey there! not really sure how to message you directly on this platform, is there anyway I can talk with you personally?

  • Groups work great for things like this, because you can disable them completely when you're not using them. Here is how I would do it:

    Every 0.03 seconds (30 times per second, because no need to check every tick)

    -Is mouse overlapping Whatever


    -Is Group "Tooltip" Deactivated

    -> Activate Group "Tooltip"


    trigger once

    -> Move tooltip to spot, make visible, etc (this is showing the tooltip)

    every 0.03 seconds

    -is mouse NOT overlapping whatever (checking to see if tooltip should be disabled)

    ->move tooltip far away, make invisible, etc

    -> deactivate Group "Tooltip"

    This way you're only checking if NOT OVERLAPPING when the tooltip is actually active, so your collision checks are halved (or fourthed if you were checking every tick and not every 2 ticks before)

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