How do I display Text on Overlap and delete it again

0 favourites
  • 11 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hi Guys

    It's probably a dead simple solution but i'm not quite sure how to tackle this yet...

    Here's what i'm trying to achieve: i have a Character Sprite set up and i'm trying to prototype a situation, where the HUD has a set Text Box, where Information, Dialogue etc. is displayed. Now, the Player is controlled via Keyboard in a Platform fashion. What i'm trying to do is, that on Overlap with an Object in the Layout, the Object changes its Animation Frame and displays a descriptive Text in the Textbox. When the Player leaves the Overlap again, the Text disappears as well and the Text of the next overlapping Object is shown instead.

    I kinda know why its not working at the Moment. The thing is, i invert my Action on overlap which of course makes construct think, that i never want to show any Text in the Textbox because the Character is always NOT overlapping with at least one of the two objects, so the Text gets set to nothing (or made Invisible) at all times...

    Do you have some tips for a good solution on this? Should i try it with some kind of Instance Variables that sets the Text to Visible/Invisible?

    I'm very grateful for the great help a (still) untalented N00b like me gets here so thank you very much in Advance!!!

    Maybe to make things a bit more clearer, here some Screenshots:

    The In-Game Screenshot shows how it kinda should work (although the second blue Hotspot had his Animation Frame also set to 1 which you can see by the white outline, which shouldn't happen until the Girl overlaps). Here i took out all the inverted Stuff, so of course it works but the Textbox doesn't empty itself anymore. I hope it was kind of understandable

  • try this..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Errr.... Well... That was so easy it's kind of embarassing actually :S Well, i tried the Else before but not in this configuration...

    Sorry for taking away Forum Space and thank you very much for your help ))

    Interesting though that i have to keep the Else Statement BETWEEN the two Overlapping Events and not beneath all of them even i'm referring to the second Block in the Else Actions as well... Something i'll have to keep in mind i guess

  • Sorry to dig out this old topic, but there must be an easier way to do this. Because the solution korbaach showed me works perfectly with two objects but as soon as i add more, i can't get it to work properly, no matter where i put the else statement.

    All i want is that the Text is ONLY displayed WHILE the character is overlapping the object... As soon as she leaves, the text empties... No idea how to do that though :S

  • is overlapping a: texta


    is overlapping b: textb


    is overlapping c: textc

    else: notoverlapping

    Or more elegant, put them into a family.

    is overlapping family: set text to family.texttodisplay (instance variable)

    else: set text to "not overlapping"

  • Thanks mindfaQ

    Unfortunately, it doesn't let me do more than one Else at a time...

    With the other example with families i don't quite get how i can display different Texts for each Item. The Idea is, that the player eventually can pick those up but when they're still on the ground and the player walks over them, it highlights them and shows it's name in a fixed Text Box...

  • Else works like this:

    read the first and second else as "else if" in your mind if you want

  • Oh! Now i got it Thanks a ton!! mindfaQ

    Still interested though in how this would work exactly: set text to family.texttodisplay (instance variable)

    So there's a way to display an Instance Variable of the different Objects when they're in a family? That would sure save a lot of work

  • you could try a number of ways...

    but..eventually you'll need something like this:

    Capx> ... 4105212900

  • Oh my... That's kinda depressing with three Events and yet i have no idea (yet) how to do something like this Better look into the Ajax Plugin then...

  • Ok..I will try to explain. <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused">

    affter Ajax...

    first you need to check

    Dialoge text looks like:

    (left double click..on txt file to check this)

    on end of each line i put Separator #.....

    now check

    tokenat(src, index, separator)

    Return the Nth token from src, splitting the string by separator. For example, tokenat("apples#oranges#bananas", 0, "#") returns apples.

    capx has several Spot(redSprites)..each Spot has Id ..first.Id=0; second.Id=1..............

    so ..

    if player overlapping first spot..text will display first line from Dialogue...if second..then .text will display second line from Dialogue..etc <img src="{SMILIES_PATH}/icon_e_confused.gif" alt=":?" title="Confused">

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