Day 4: GameJam #Redefine2021

On this day, I have finally started with the gameplay mechanics. I was able to finish the basic movement including a double jump and some push interaction.

After thinking about it for a while, I decided to go with Unity Physics2D. Of course, I immediately ran into problems with it. But more about this below.

I created a PlayerController that grabs the input from keyboard or controller (using the asset InControl to manage this) and sets the velocity on the Rigidbody2d of the player sprite (or future sprite, when I have graphics for him).

It has different modes for roaming around or pushing objects around. When you get close to the box, the trigger will notify the PlayerController of a nearby interactable and he will then focus it, which will display the interaction label. Pushing the grab key will now switch to the push mode and attach the box to the player by reparenting the transform. Now you can only move left and right (not jump) until you let go of the grab key.

The movement worked fine from the beginning, but when falling down from a certain height, Unity Physics2D will fail to stop the player box from penetrating the floor. To avoid this, I actually had to do my own raycasting that checks for penetration and moves the player out of the floor.

Leave a Reply

Your email address will not be published. Required fields are marked *