How to make Custom Mouse Cursors in Godot | Game Dev Tutorial 7

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends welcome back to Dave the devs game dev tutorials it's been a while since the last video because I've been busy participating in the community game jam if you'd like to take a look and see what I made for the jam you can follow the link below but that's not why we're here in this video I'll show you how to make your games better by using a customized mouse cursor in Godot so let's get to it theming a users experience with your game is exceptionally important if a player has to look at this it might break the experience or trying to convey in their mind so I'll show you how you can go about simply changing the mouse icon or if you need a bit more how you can create dynamic mouse cursors that even react and change with gameplay if you only need to change the cursor icon here's a quick and simple method to do that first I'm going to create and save a new scene for us to experiment with then I'll add an image that I want to use as a mouse cursor to the Godot project folder this is what our scene looks like by default before applying our new cursor icon to set our new image as a cursor click on project up top in the main menu and head to project settings in the project settings window find mouse cursor under the display settings and then simply set the custom image to the image of your choice now when we run our demo scene our mouse cursor has been changed to our selected image when using this method keep in mind that images with sizes above 256 by 256 pixels won't work now if you need something a bit more complicated than simply changing the cursor you can in fact make a mouse cursor from any scene that has a root node derived from a canvas item node this basically means a mouse cursor can be made from control nodes or a no 2 d node including sprites animated sprites texture X or even a video player to show you how this can be done I'll make and save a new scene using notes derived from the canvas item object and I'll add a script to the root node under the ready function type input set mouse mode and pass the function input mouse mode hidden this code will hide the default mouse cursor while it's in our game window next under this nodes process function type self dot position equals self dot get global Mouse position it's probably pretty obvious but this line of code sets the position of this node to the position of the mouse cursor once every frame when it's in our game window I'm going to add a sprite node to the scene root and then populate the sprite notes texture property with our mouse cursor image finally let's give this a quick test by creating and saving mouse cursors in this way you can simply drag and drop them into other game scenes and you're not just stuck with a static image you can use this as a base to build more dynamic mouse cursors here's an example scene doing just that depending on which side of the game window the mouse is currently hovering over the cursor icon changes between white and black spheres but the possibilities are virtually endless only limited by your own needs and imagination for example you could animate the cursor using animated sprites or animation players you could use a particle 2d node as a cursor or maybe even attach an audio stream player 2d and change the source of a sound effect or music as the mouse moves through your game in my latest game welcome to the afterlife made for the community game jam I used a rotating sprite as my mouse cursor if you want to check out how I did it there are links in the description below to the day of the dead github page where you can download it and the example projects in this video I also made extensive use of the curve resource in my new game to control the chance of enemies spawning if you want to learn how to use the curve resource to check out my previous tutorial in the subject well that'll do for this video if you learn something cool consider hitting the like button and if I've earned it subscribe and hit the bell icon to be a part of this growing game dev community hope to see you in the next video until then see how crazy you can make those mouse cursors you
Info
Channel: Dave the Dev
Views: 8,954
Rating: undefined out of 5
Keywords: Godot, Game, Dev, Development, Tutorial, Game Dev, Mouse Cursor, Custom Mouse Cursor, Godot Game Engine
Id: i4yweU0Pva0
Channel Id: undefined
Length: 5min 39sec (339 seconds)
Published: Sat Sep 07 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.