Mouse click not working [SOLVED]

Started by Baron, Wed 23/11/2005 04:50:25

Previous topic - Next topic

Baron

My mouse cursor clicks appear not to be registering beyond 320x, 200y in a scrolling room.  I've altered the original code thusly:

function on_mouse_click (int button){
     ....
     else if (button==LEFT) {
     ProcessClick (mouse.x +GetViewportX (), mouse.y +GetViewportY (), GetCursorMode () );
}
...
The funny thing is, I've used this code before and it worked just fine.  This game compiles fine, but then won't register mouse clicks beyond 320x, 200y.  The only things I've done that I've never done before are:
      -The main character follows the cursor in Repeatedly Execute (room) -he follows fine everywhere with THE SAME CODE!!!!!
     -I've got a LOT of sprites idle.
       The only thing I could think of is that I might have too many sprites, but as I say it seems to work fine on the upper left hand side of the screen.  Does anybody out there have any idea of what might be wrong here?

EDIT:  I also have a whole screen GUI (with no buttons, only a background image) that completely blocks mouse clicks, including right-click cursor cycling.  When I turn it off I can click again, but only in the upper left hand corner.  Could the GUI be interferring with mouse clicks even when it's not on?  And how can you set a GUI so it's clickthroughable?  I have a large hole in the centre of my GUI, but I suppose the game could be interpretting the hole as part of the GUI.... 
       Also, I'm using AGS version 2.6.  Yes, I know I should upgrade, but I'm in the middle of finishing my MAGS game and I have no time to learn the new features at the moment!
     

strazer

#1
Quote from: BaRoN on Wed 23/11/2005 04:50:25
My mouse cursor clicks appear not to be registering beyond 320x, 200y in a scrolling room.  I've altered the original code thusly:

The default code should process mouse clicks in scrolling rooms just fine.
Try changing
  ProcessClick (mouse.x +GetViewportX (), mouse.y +GetViewportY (), GetCursorMode () );
back to
  ProcessClick (mouse.x, mouse.y, GetCursorMode () );

Quote from: BaRoN on Wed 23/11/2005 04:50:25
-The main character follows the cursor in Repeatedly Execute (room) -he follows fine everywhere with THE SAME CODE!!!!!

The Character.Walk function needs to have the GetViewportX stuff added since it expects room coordinates, not screen coordinates like the ProcessClick function. ProcessClick automatically adds the viewport offset to the mouse coordinates if the walk cursor was used.

Baron

AHA!
      I guess since it didn't work initially (because of the GUI problem -see edit above) I thought I had to change the on_mouse_click function.  Then, when it did partially work after I removed the GUI, I assumed I was on the right track. 
     So..... any ideas how to stop a GUI from interferring with mouse clicks?

strazer

Transparent parts of GUIs don't let clicks through (already tracker'd), so yes, the GUI is probably interfering with the mouse click. Just uncheck the GUI's "Clickable" checkbox in the GUI editor.

Baron

Ah, sweet simplicity!  The things you wish you knew several hours ago....  Anyway, thanks a whole bunch Strazer!  My MAGS entry is now up and running.  Now to tend to that pesky plot...

strazer


SMF spam blocked by CleanTalk