Who Ate my Mouse??


Mouse & Joystick Control

The scaffold for this project came together quickly, but coming up to the mid/end of the development I ran into a wicked problem with the GUI vs the Upgrade cards. I created this in Godot (I'm in love) and the GUI, a packed scene, sits on the main scene.

The GUI has all the scores, ammo, health labels etc. When you collect enough XP for an upgrade, I generate the upgrade cards which are packed scenes, within which are buttons to select your 'freebie' or 'buy'. The targeting cursor is also a packed scene in the main scene and contains an Area2D so I can use the cursor as a selection tool, just like a mouse cursor. I wanted the game to be both keyboard/mouse and Joystick, with minimal hassle on switching between the two.

The issue I started running into involved the targeting cursor being able to collide with the upgrade cards while allowing the mouse to make contact with the upgrade card buttons - depending on whether you were using keyboard/mouse or joystick. It seemed that I could either generate the upgrade cards as a child of the main timeline which allowed my Area2D cursor to collide, but not the mouse, or make the cards a child of the GUI which allowed my mouse to work, but my Area2D in the targeting cursor would not.

This was quite a bit later in development and I had coded myself into a couple of corners that were going to make 'universally' solving this very difficult without stripping things way back and possibly breaking a lot of other very nice code. 

So I ended up with a hack, I made the GUI invisible when the upgrade cards were generated as children of the main scene, this made everything work, the mouse could click the upgrade card buttons and the Area2D in my targeting cursor could be recognized by the Area2D's also in the upgrade cards. I really did spend 4 days going back and forth to see if there was another way to get it running without such a blatant slash/fix, but, as of right now, it works and the drawback is minimal.

Files

nanopurge.zip 110 MB
80 days ago

Get Nano-Purge

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.