Awesome Custom Cursor
I made this Godot 4.x addon to facilitate custom cursors in my games (notice how I have more addons than games) and it turned better than expected.
Initially, I was just making an AnimatedSprite2D follow the mouse around, however, the drawback is that theres always a frame of delay. You can mitigate that with higher frame rates but if you’re banking on the user having a top tier computer, I wont like you very much. (specially because i am the lower end of users)
Initially, i wanted to have custom shapes, like I wanted the cursor to turn into a crosshair when theres something to shoot at, or a heart when theres a health pickup, or an eye when theres something of interest, things like that. And in fact, that was version 1.x of my Addon you can get version 1 in the releases of the project.
In summary, you make an animation with your frames matching the name of the shape like:
- pointer
- busy
- can_drop
And i look at the current shape and play the animation with the same name (with a bit of parsing on my end). And thats it, you have an animation of a cursor stuck to your real cursor.
However i realized we use at most 5 cursor shapes, those being:
- Pointer
- Drag
- I-Beam (the one you have right now when hovering over this text)
- Help (the one with the question mark)
- Busy
And Godot has 17 of them, and I got really fed up with the 1-frame delay. So instead of making a image following the mouse, so i made a “native” one with is version 2.x and the one you are seeing.
Now, Godot does not have animated cursors, its just static images so what I took the animation system of v1.x and made is so on every shape change you play an invisible animation, and i project the current animation image into the mouse. In other words We force the engine to be animated by changing the frames manually.
There’s still the drawback of only having 17 shapes, if you’re making an app or just want more shapes, tough luck, but i still have v1.x available if you’re in the need of more shapes.
You can get these versions: