Scrolling Game Development Kit Forum

SGDK Version 2 => Help, Errors, FAQ => Topic started by: SmartBoy16 on 2010-02-22, 08:02:13 AM

Title: Could you add a MouseUp and initial only event?
Post by: SmartBoy16 on 2010-02-22, 08:02:13 AM
I'm just throwing out a few suggestions for the next release.

For the IsMousePressed function, is there a way to add an "Initial Only" thingy to it?
And how about a IsMouseUp Function?

I've completed both on my own by using a series of flags and if/elseif statements (On my next Midnight release) but it would be nice to have those built in.
Title: Re: Could you add a MouseUp and initial only event?
Post by: bluemonkmn on 2010-02-22, 09:12:53 AM
IsMouseUp is the same as Not IsMousePressed, right?  Why not just use that (check the "Not" box)?
To implement Initial Only for the mouse, you could add a parameter to the mouse pointer sprite (assuming you have a mouse pointer sprite) called "WasMousePressed" and then check:
1. If IsMousePressed
2. If WasMousePressed != 1
  a. WasMousePressed = 1
  b. Do Stuff for intial only mouse press ...
3. Else (if IsMousePressed was false) WasMousePressed = 0
Title: Re: Could you add a MouseUp and initial only event?
Post by: SmartBoy16 on 2010-02-22, 10:00:18 AM
that's exactly what i did! except for the last else i made a new function, copied the IsMousePressed, and changed the "!=" to "==". it works, but I guess your way is a lot easier.
Title: Re: Could you add a MouseUp and initial only event?
Post by: bluemonkmn on 2010-02-23, 06:15:57 AM
The reason IsMouseUp is not built in is because it just seems silly to create another whole function when all you have to do is check a box on an existing function.
The reason Initial Only isn't available for the mouse (I see now) is because if you use MapMouseToSprite, you should be able to use IsInputPressed (which already has InitialOnly) to check the state of the mouse buttons on that sprite.