if(isMouseDown(clipName))

I think it would be good if we were able to have the built in isMouseDown code work the same way as the isKeyDown script, for example, isKeyDown(“key”) checks if a key is down, but isMouseDown only checks if the mouse is pressed down. I think if we were able to write isMouseDown(clip) and it returns true when the cursor is pressed down on the clip, it would be helpful.

Also, it would be also great if we have a isMouseJustPressed(clip), isMouseReleased(clip), isMouseJustHovered(clip), isMouseHover(clip), isMouseLeave(clip), and an isKeyReleased(“key”) code.

This will allow us to check if a mouse event happens to an object without having to write the code inside of that object.

The isMouseDown() function returns true every time the mouse is down, even when the mouse doesn’t enter the clip. My suggestion is that we can define the clip that this function checks the mouse is on before returning true, as well as have more mouse functions that work almost the same way the isKeyDown(“key”) and the isKeyJustPressed(“key”) function works.

if(isKeyJustReleased("space"){
/* returns true once the space key is released */
}

if(isMouseDown(Clip)){
/* returns true every tick when the mouse is down on the clip */
}

if(isMouseJustReleased(Clip)){
/* Returns true once the mouse releases the Clip */
}

if(isMouseJustHovered(Clip)){
/* returns true only once when the mouse enters the object */
}

if(isMouseHovers(Clip)){
/* returns true every tick when the mouse is over the object */
}

if(isMouseJustPressed(Clip)){
/* returns true only once when clip is pressed */
}

if(MouseLeaves(Clip)){
/* Returns true once mouse leaves clip */
}

if(isMouseClicked(Clip)){
/* Returns true when clip is clicked */
}

etc.
4 Likes

By reading through Wick’s sources, I found out that some of the things I suggested here already exist.

Here’s a code that does most of what I suggested

Clip._mouseState

The code returns “over” if the mouse is over the object, returns “out” if the mouse is outside of the object, and returns a value of “down” if the mouse is pressed down on the object

There’s also this:

Clip._isClickTarget

which returns true if the clip is clicked

1 Like

This might actually solve that Fruit Ninja bug. Thanks for finding these things! :)

1 Like