Mouse checkpoint

I’m having a problem checking the mouse it doesn’t follow the mouse it stays away even though it’s in the same position as mouseX and mouseY .I’m trying to create a slider for the right left character like the game and platformer.

estou com um problema no check do mouse o mesmo não segue o mouse ele fica distante mesmo estando na mesma posição do mouseX e mouseY .estou tentando criar um controle deslizante para o personagem direita esquerda como o jogo e de plataforma.



For example: the mouse check follows the mouse but the distance is not right even using MouseX()
MouseY()

Things to check:

  • Are you using layers?

If so:

  • Is Mouse_Check in a layer following your camera?

When using layers, the layer where the mouse click / screen touch detection is done is important because the X and Y values depend on the layer / camera position.

Try to move your Mouse_Check to a different layer.

If you aren’t using layers, then check the origin point of your Mouse_Check object. It may be put outside the object, leading to the bad following.

I hope it helps.

2 Likes

yes i’m using layers, game and platform so the character just walks diagonally.

Then try to move your Check_Mouse objet to another layer and see how it goes. My best hopes.

1 Like

does not work already tried, do you know if there is another way to make this slider the way it shows the image? I saw a picture on google but find it on the forum.


that way I want to do it, but I didn’t find it on the forum.

I recorded a video.
https://drive.google.com/file/d/1uteSDQlaLEJ20hdjAceSyxT4LXppAdI5/view?usp=sharing

I am not sure if this may be helpful, but there is a topic about making a virtual joystick

1 Like

You placed mouse_check on the layer Gui, but take the mouse position from the base layer - the default layer for MouseX().

You can’t do that, especially if you have parallax scrolling.

If you place mouse_check on the Gui layer, then you must use MouseX(“Gui”, 0) and MouseY(“Gui”, 0) to get the correct mouse position.

Think of it this way. If your Gui layer doesn’t scroll, but the base layer has scrolled by 100 pixels both left and up, then what used to be 100,100 is now 200,200 on the base layer, but still 100,100 on the Gui layer; so you end up drawing the object at 200,200 on the Gui layer, when it should still be at 100,100, because the Gui layer hasn’t scrolled…

3 Likes

yes I tested it yesterday it didn’t work either but the mouse check it’s just for testing. what I want to do and a slider joystick equal to the image.

Did you use the following, because your video shows something else?

1 Like

https://drive.google.com/file/d/1gmM2MtllDxzHNqoYsgPjT6SpFwRWsJnX/view?usp=sharing
I had tested this method yesterday friend, it still didn’t work.

1 Like

The offset seems to be consistent regardless of the layer. Where is the origin on the mouse_check?

the mouse check is created at the mouse position at the beginning of the scene.

I think the meaning was lost in translation :smiley:

The origin is a point defined on the object :

1 Like

sorry, I’m using google translator the origin of it is in the center the sprite you 64x64 the point of origin is in 32x32 center.

Ok, so the origin is not the problem. Then the only other thing that springs to mind is that the layer has been offset.

Can you provide screen shots of all the events that scroll the various layers?

1 Like

I will record a video because it’s easier.
but even removing the included events from it. and another thing I don’t know if it has to do with this when trying to generate the project for android’s error.

https://drive.google.com/file/d/1hnMG5l8zynIopaD-8judytryn08l95Va/view?usp=sharing