Simultaneous Mouse Press and Release


(Crofty) #1

I just want to double check. Is it possible for Input to have both mousePressed and mouseReleased as true?


(Nate ) #2

Well pressed would be clicked and released would be getting your finger off of the mouse button, so I would guess no? That would be like having the same boolean in a conditional for example, if(isClicked && !isClicked) I don’t think that would do anything.

Are you trying to achieve a mouse over effect? If so I would recommend Input.mouseUp ;D


(Crofty) #3

I’m making a button and checking Input to decide how to change states. However, if the mouse is pressed and released on the same update cycle, I might miss the mouse press. On the other hand, I might make my class more bloated if I’m checking for press and release when it could never happen anyways.


(Zachary Lewis) #4

Looking at net.flashpunk.utils.Input, it seems like mouseDown and mouseUp are mutually exclusive, but mousePressed and mouseReleased aren’t. So, you should check for both mousePress and mouseRelease.