DEV Community

Cover image for Contrast Devlog #1 - Setup & Movement
Ibrahim Elaradi
Ibrahim Elaradi

Posted on

Contrast Devlog #1 - Setup & Movement

May 8th, 2023

This is a project that I've been slacking on for ages now, I decided to get back on it from scratch and actually write a devlog on it every once in a while and see if that motivates me enough to release it to the public when finished ๐Ÿ˜ค๐Ÿ˜ค

Old repositories of the same project

The Idea

Shift (webgame)

I'm taking the core concept of flipping the room from "Shift", an old webgame developed by Antony Lavelle, and expanding on it in terms of game mechanics and level design.

Project Overview

I've started up with an empty Godot project and immediately started working on player movement and controls.

Player Movement

Using the very helpful template script that CharacterBody2D provides initially, I've expanded on it to add some variables that allow me to fine tune the movement to something that works for the game.

Tweakable variables from the inspector

The movement logic looks like this, _handle_movement function is called inside the _physics_process callback, for the movement to actually happen, move_and_slide is called at the end of _physics_process.

Movement logic

And this is how it looks in game

Player movement in action

Shifting Between Black & White

Player shifting realms

To achieve this, I made use of the physics layers that can be attached to each tile individually in Godot's tilesets.

I first added two physics layers with each one having a different collision layer, and each representing a different realm.

Physics layers for tilesets

I can then switch the player to another realm (physically) by changing the collision_mask between 1 and 2.

As for the transition between black and white for the player, I used an AnimationPlayer to animate the properties of two sprites carrying different colors and produce the following result.

Player transitioning animation

After setting up the animation and the physics layer, all that's left is scripting the shifting logic by combining those two components together along with the offsetting actual position of the player (up or down).

What's Next?

Having the movement and realm shifting logic done is great, but that has always been the easy part for me (keep in mind that I've done this 3 times in the past already ๐Ÿ˜…๐Ÿ˜…).

The hard part for me is level design and keeping the game juice up while progressing in levels, although the core mechanic is still the same, I've got a few ideas that I'm going to share for feedback in future devlogs once I advance further in the development.


Thanks for taking the time, until the next log ๐Ÿซก

Top comments (0)