Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

So far my progress has been adding a dark orb like a black hole, a light orb, and a simple day/night cycle.  And also getting stuck trying to get gamepad or keyboard + mouse to work depending on what you have. For some reason, that was way harder than it should have been! Anyways, you can move the player in first person, Left Analog stick for movement, Right Analog stick to rotate the view, or mouse movement to rotate view and WASD to move. Not much gameplay yet, but I hope to start plugging in the fun in the next few hours.

Here's my first build so you can look around.

CGDC Speedgame 2021: Hardmode (Name TBD) by Burnerknight Studios (itch.io)

It's probably too late to do it at this point, but the Unity Input System package makes controller input so much easier.  However, it takes a little bit to figure out how it works as you define controls in a configuration file, then connect them to a PlayerInput component on a game object and link the input to the method to call within that game object's script.

I'll definitely need to look into it in the future. What caught me was that I was trying to use a conditional to switch how a variable was used depending on if you had a gamepad connected or not. I tried using the Input.GetJoystickNames but lost time trying to get that to work reliably. So my next step was to use a different solution. I started cutting out code until I got to a functional minimum.

This is what I ended up with:

if(Input.GetAxis("Mouse X") != 0 || Input.GetAxis("Mouse Y") != 0)
        {
            tiltAroundY += Input.GetAxis("Mouse Y") + Input.GetAxis("Mouse X");
        }
        else 
        {
            tiltAroundY += Input.GetAxis("Mouse Y2") + Input.GetAxis("Mouse X2");
        }

So if you're using a gamepad, Mouse X and Mouse Y will correspond to the Right Analog stick on the gamepad and allow you to rotate the camera. If you don't have a gamepad, Mouse X and Mouse Y will always be 0, and so therefore the else conditional will run, using the next axis which will work with your mouse.