Getting a handle on the mouse

This forum is currently in read-only mode.
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Needless to say, I failed epically

    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

    [quote:32fo0oo1]First problem: detecting that the mouse button has just moved down.

    '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)

    There is no difference. Construct is not case-sensitive.

  • 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".

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