Mouse is over object....

Get help using Construct 2

Post » Sat Oct 27, 2012 7:19 pm

I'm trying to get a line of text to display text when the mouse is over certain objects. The event is fairly simple, just 'Cursor is over object', 'Set text... '. It works, but if I then put an identical event below the first one, only one event responds (the lower line). Any ideas why?
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sat Oct 27, 2012 7:30 pm

Because events sheets are executed from top to bottom every tick (as explained in how events work).

So the first event is executed, the text is changed.
And then the second event is executed so the text is changed again.
So you are under the impression only one of the two events happens, which is false.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sat Oct 27, 2012 10:28 pm

But if the mouse is only over the top of one of the objects, then surely only that event would fire? What's happening is, if the mouse is over the top of the object in the first event, it never fires at all.

I understand that if the mouse is over both objects, it will simply fire on each event and the 2nd event will be the one that was executed last.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sat Oct 27, 2012 10:41 pm

It's because I was using a third 'else' event, to clear the text. The idea being, if event 1 or 2 fire, then it displays the object name, else is clears the text. But I guess I wasn't using else correctly as I was just using it as a seperate event at the bottom.

Solved it by just clearing it at the top on every tick.
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: R0J0hound, randomly, Yahoo [Bot] and 25 guests