Getting a handle on the mouse

For questions about using Classic.

Post » Sun Jun 15, 2008 12:11 am

Hi everyone -- confused noob speaking.

To get my feet wet with Construct, I tried to build a little app that lets the user click-and-drag the mouse over a Canvas, then draws a black line from where the mouse button went down to where it came back up again. Needless to say, I failed epically (although I did manage to get black lines from (0,0) to the mouse position).

First problem: detecting that the mouse button has just moved down. As far as I can tell from the MouseKeyboard object information and some experimentation, there are conditions for "Mouse button is down" (which remains true while the button stays pressed) and for "On mouse button released" (which fires once when the button comes up).

However, the reverse cases (*"Mouse button is up" and *"On mouse button depressed") are conspicuously absent. Are they somewhere else where I didn't look? Or is there a simple way to fake them (e.g. a negation operator for Conditions)?

Secondarywise, mouse coordinates. I couldn't work out whether expression names are case sensitive -- is there a difference between "MouseX" (from MouseKeyboard) and "mousex" (from System), and if so, which should be used when?

I also had problems assigning values to variables, but I guess I'll leave these for another day. Let's clear up the input stuff before adding complications ;)
B
2
S
1
G
4
Posts: 60
Reputation: 1,320

Post » Sun Jun 15, 2008 1:27 am

[quote="Znirk":32fo0oo1]Needless to say, I failed epically [/quote:32fo0oo1]
Remember Construct is in Beta. It may be difficult to tell if you're just starting out, but Construct could be failing epically, not you :P

[quote:32fo0oo1]First problem: detecting that the mouse button has just moved down.[/quote:32fo0oo1]
'On click' fires when the mouse button goes down, 'Mouse button is down' is true for the duration of the button being held down, and 'On mouse button released' fires when it is ... released. Yeah.

[quote:32fo0oo1]I couldn't work out whether expression names are case sensitive -- is there a difference between "MouseX" (from MouseKeyboard) and "mousex" (from System)[/quote:32fo0oo1]
There is no difference. Construct is not case-sensitive.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Sun Jun 15, 2008 9:06 am

Ah, OK, thanks. I simply misunderstood On Click then -- I thought that's "button goes down and up while pointer is on the same object".
B
2
S
1
G
4
Posts: 60
Reputation: 1,320


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests