How do I display Text on Overlap and delete it again

Get help using Construct 2

Post » Tue Apr 14, 2015 9:09 pm

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:

Image

Image

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 :)
B
14
S
5
Posts: 80
Reputation: 1,112

Post » Tue Apr 14, 2015 9:25 pm

try this..

Image
Image
B
62
S
23
G
7
Posts: 1,470
Reputation: 10,731

Post » Tue Apr 14, 2015 9:33 pm

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 :)
B
14
S
5
Posts: 80
Reputation: 1,112

Post » Fri May 01, 2015 9:06 pm

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
B
14
S
5
Posts: 80
Reputation: 1,112

Post » Fri May 01, 2015 9:20 pm

is overlapping a: texta

else
is overlapping b: textb

else
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"
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sat May 02, 2015 12:51 pm

Thanks @mindfaq

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

Image

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...
Last edited by joel87 on Sat May 02, 2015 1:01 pm, edited 1 time in total.
B
14
S
5
Posts: 80
Reputation: 1,112

Post » Sat May 02, 2015 1:00 pm

Else works like this:
Image

read the first and second else as "else if" in your mind if you want
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Sat May 02, 2015 1:05 pm

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 :) Unfortunately, i can't quite figure it out :(
B
14
S
5
Posts: 80
Reputation: 1,112

Post » Sat May 02, 2015 1:24 pm

you could try a number of ways...
but..eventually you'll need something like this:
Capx> http://s000.tinyupload.com/index.php?fi ... 4105212900
Image
B
62
S
23
G
7
Posts: 1,470
Reputation: 10,731

Post » Sat May 02, 2015 1:33 pm

Oh my... That's kinda depressing with three Events and yet i have no idea (yet) how to do something like this :D Better look into the Ajax Plugin then...
B
14
S
5
Posts: 80
Reputation: 1,112

Next

Return to How do I....?

Who is online

Users browsing this forum: Darknessed, FabianB, SnipG and 11 guests