I’m working on a system for my game, and I noticed that the mouse move behavior only outputs data whenever the value is changed, although it doesn’t update the mouses location when the curser gets moved by means of a player with a camera.
I have a dash ability where the player dashes in the direction of the curser, for some reason I can’t use extractors on a UI object, so I decided to use the mouse move behavior. Although I can dash properly when the curser is moved, but when I walk around without touching the mouse and go to dash, I end up dashing in the wrong direction because it registers the curser behind me when the curser is actually infront of the player.
I don’t know if there’s a specific set of code that can be used to help update the curser so it can constantly emit for large map games, but I’m currently at a loss at the moment and can’t think of any possible solutions for it. I’ve had this issue many times in the past, but usually neglected the feature and replaced it with something else. As of now, it’s a crucial part of the game and I want to know if there’s any sort of solution for it.
make the mousemove outputs set number values that have always going into them
I suggest using the UI coordinates and add the camera position to it.
Using game coordinates will not update if the camera moves, and the camera will also be outputting when the mouse isn’t. If the camera isn’t moving or if the player isn’t always in the center, then I would also suggest using an Always here too.
I attempted an always, but the cursor won’t update the values unless it moves. I have a cursor in the UI layer, but when I take my hand off the mouse and walk around with the camera following, then try to dash, it attempts to dash towards the location of the mouse when I stopped moving it, not where it’s at, even though the cursor follows the screen, because it’s in the UI layer. If I made the cursor in the game layer, even then, the mouse move only emits the location when moved, but not constantly updating and when I walk around, the game layer cursor goes off screen. The similar thing is happening with the UI, but at least the UI cursor stays on screen.
What I mean by constant emitting was that the mouse move doesn’t constantly emit it’s location or data values unless moved manually.
Are you adding the camera position with the mouse?
I am not. I’ll have to try it in the morning. Would it allow the mouse to update the location in the game layer while the player moves around?
If the mouse is in the game layer, then still use the UI layer in the mousemove setting and add the camera position. And then have the camera and mouse update the mouse object position in the game layer. I would still suggest using an always to number after the mouse for if you ever move the player without moving the camera.
UI position + Camera position will always = the current UI position in the game layer.
Even if the mouse isn’t updated.
I currently have a camera effect that follows closely behind the player to make the game have smoother movements. Would this effect that at all?
The mouse position will be in the correct spot relative to the UI.
How you are moving the camera is irrelevant.
I was confused at first, but I eventually got it. Thanks for the help.