I am working on a FNAF fan game here on Gdevelop.
In the game, I created this custom cursor object for the game (because it’s cool) and I put it on a separate layer above all so nothing overlaps it. But now because of that the cursor constantly goes out of bounds and detaches from the mouse when I scroll to the side.
I understand your misunderstanding with my problem.
So the in the game I’m currently working on I have a method of scrolling using the cursor like in a Five Nights at Freddy’s game (if you have never played it then just try to see what I mean on like youtube). But because of the custom cursor, the sprite for it went out of bounds, which I have already fixed. But because of the way I coded it:
It now detaches when I scroll to the sides, and yes, I already tried the cursor behavior, it doesn’t fix it. That’s basically the problem.
I really do not get what you mean
I mean i understand that mouse does not stick to cursor that is your issue
But i do not get when
So i cannot deduce why
Can you paste link to preview?
Like hit share button on top then publish to gd games and share the link so i can see it
I am re reading your answer and did you do anything to mouse itself?
Cause you should not
You should always set it position to cursor
Like have no condition in that event
Only thing you do is restrict camera
This is the only code I have for the cursor on the entire thing, all other code is attached towards the mouse sprite (except for like parts where you have to click something). I already tried the cursor behavior but it doesn’t make a difference.
Also I can’t attach links to my posts :((
wait so specifying the layer isn’t required?
and if it is, do I set the layer as the layer with the custom cursor or the base layer? Just to be sure. I’m very new to Gdevelop :\
Ow and to be clear
You mostly don’t but this is why i say its stupid for me
For example if you have zoom 3 on base layer and zoom 0 on layer on which you have mouse
I DO NOT remember do you need to specify layer in CursorX() and Y
But then you need to apply same zoom on layer on which mouse is
Like i said most of the cases its not required
But my course of actions is
1st go with CursroX() CursorY()
If it does not work and i have mouse sprite on different layer
Then i try to apply same actions to layer on which mouse is
Like zoom and center camera (basically you copy your layer actions and in duplicates you change layer to layer on which mouse is)
And if that does not help then i specify layer in ()
I don’t get it i don’t want to learn why i don’t care what is correct answer
All i care is that following these 3 steps in that order always solves issue for me
This almost worked. It fixed the detaching thing but now the left scroll and some buttons don’t work, well they do work, but the area to click the button is off set. I think this just might be a problem with some other code I wrote down, but IDK. If you can’t solve this, it’s fine, I’ll try find another way.
Is the click button layer fixed, while the mouse layer scrolls? If it is, you’ll have to determine the offset of the mouse when it’s layer scrolls, add that to the mouse position, and then check if that point is in the button.
The trigger for the button’s movement isn’t connected to the cameras. If you read the problems I had, you would know that the game and scrolling. I didn’t make it connect to the camera so you actually need to get to the destination to click the button.
This is the code I have for it: