Character Movement


Overview

In this game, there are multiple characters (or sprites) that move synchronously based on the user input. The input are as follows:

  • Left arrow - To move the characters leftwards
  • Right arrow - To move the characters rightwards
  • Up arrow - To move the characters upwards (only when the characters are at the bottom of a ladder)
  • Down arrow - To move the characters downwards (only when the characters are at the top of a ladder)

Implementation

The two characters (the two square sprites) seen within the initial game are parts from a prefab called "Character". The two ladders (the two brown rectangle sprites) are parts from a prefab called "Ladder".

The basic character movement has been implemented for the characters (the two square sprites) by a basic movement script attached to the Character prefab. This script provides the ability to attach the Character prefab's Rigidbody2D and BoxCollider2D components onto the script.

The characters are able to move because the Character prefab's Rigidbody2D component is attached to the basic movement script which allows the script to change the properties of the characters' Rigidbody2D component such as the velocity based on the user input.

The characters are able to collide with other objects (such as obstacles or the other character) because the Character prefab has a BoxCollider2D component and other objects also have a BoxCollider2D component.

GiveWaterBuildVer1PlayerMovement

The basic synchronous movement of the characters when the left and right arrow keys are pressed.

Currently the characters cannot climb up or down a ladder as this function have not been implemented yet.

Feedback Received

From Jaden:

I love the way your players movement, they are synchronous, your idea is very creative. But I think it is quite simple movement right now, I am eager to play your game one more time when it is completed.

Better character movement will be implemented later. The implementations will allow the characters to move at a smooth consistent speed.

From Nathan:

...the movement synchronicity seems to be working well, but once they are stuck together seems to be the end? I've never played anything like this so I imagine finding ways to split them up after getting stuck together is part of the game?  I'm now curious to see and test this game further now!

The issue of the characters becoming stuck together will be fixed later. Splitting the characters after making them stuck is not part of the game.

References

The Character Movement script contains code from the following sources:

  • KIT109 Tutorials 3 and 8 (Lindsay Wells)

Files

BuildVer1.zip Play in browser
Sep 07, 2023

Leave a comment

Log in with itch.io to leave a comment.