N
n3wb13
Guest
Hi I'm trying to use the mouse as the controller for my character but I want to set it to a certain speed. If anybody know please help me out. Thanks.
I'm trying to mimic Slither io controls for my android game. I decided to use the mouse global left pressed event to achieve it. The last problem I'm trying to tackle is the speed. So I thought maybe I could reduce the mouse speed/sensitivity. Anyways what extension are you referring to?You can't manipulate cursor speed without the use of an extension. You can, however, keep an instance which moves towards the mouse coordinates at a certain speed, then use the instance for controlling player movement.
It might not be viable option depending on how mouse movement affects your gameplay. So if you need a better alternative that suits your needs, please elaborate a bit on that.
Disable the cursor and create a custom cursor object. Manipulate this object's x/y based on mouse movements. Then use this object for your game logic?
I really want to test this out. But I don't understand it. First of all what do you mean by disable cursor and how can i do this ? ( my search always ends up with disable cursor sprite) Second I'm already manipulating my player x/y base on mouse movements so how can I get a different result out of this? Won't the speed still be the same since it's base on the mouse?Exactly, how I would do it.
I said that assuming you were trying to slow down the cursor on your PC. There isn't a built-in way for that. (It isn't possible on other platforms either, for that matter, without intermediary processing code or instances.) But on Android, things like input work differently, so you don't need an extension. And that's why I asked you to provide more information.Anyways what extension are you referring to?
What if you clamp the mouse coordinate larger than the screen at the same multiple you divide your custom cursor position with? (like, if you halve the speed of your custom cursor, you clamp the mouse at double the screen size and so on)Disable mouse sprite, create a custom mouse pointer sprite and a mouse pointer object, make its starting position middle of the screen, draw it in draw GUI event. After reading mouse speed x/y, halve them before applying them to player movement or custom mouse object position. Clamp mouse object coordinates so it doesn't move outside screen. You've now halved your mouse speed. If you need to click on things, read mouse pointer object position instead of actual mouse position.
EDIT: thinking over that again, the speed reduction part might not work... since GM gives us mouse position instead of mouse movement, it will clamp to screen edges, and reducing the deltas just clamps the custom pointer into smaller area. I'm unsure if there's any way to get raw motion data out of the mouse instead of having to rely on GM-dictated mouse position data.