Hi,
I just started using Defold and I have few questions;
How can i have the mouse {x, y} pos all the time, (without on_input) ?, I would like to make a bucket follow the player cursor.
And then, i there a better “object” than atlas to “represent” an image, I mean, in my bucket collection’s sprite, i need to specifie an image, but i can’t pick bucket.png so, i created an atlas but it did not make sense to use an atlas for holding only one image!
Using on_input is the only way to get the mouse pos. You will receive an on_input call any time the mouse is moved. If you want to use the mouse position outside the on_input function just save it in a variable that was initialized outside that function.
Using an Atlas is the way to go, the only other way to use an image is with a Tile Source. Yeah it seems weird to make an Atlas for just one image, but presumably you will need more than one image for your game at some point.
Thanks, I was stuck a moment on your response, because i didn’t received any messages when moving my mouse, the solution was to add a “fake input” in mouse section that act like a placeholder !
Ah, yes I should have mentioned that. The engine only sends mouse movement input if you have at least one mouse button mapped in the input bindings. That ought to be put in the docs.
It’s mentioned in the input manual in the mouse trigger section as a note on the right: “Currently, MOUSE_BUTTON_LEFT (or MOUSE_BUTTON_1) input actions are sent for single touch inputs as well.”