Player Movement


In Incident at the Bargewright Inn, the player is free to explore the Bargewright Inn at their own pace. The movement is inspired by old-school top down RPG's such as the Pokemon games. The controls are very simple, with simple WASD movement and eventually a button to interact with objects and NPCs. In order to give the NPCs within the game many options for movement and placement, I spent a lot of time this week setting up the colliders for objects like chairs to work in such a way that the game has a "2.5D" effect, where the rendering order of objects varies depending on the position of the player. This can be seen below, and I believe it results in a simple but effective trick giving both the player and NPCs an illusion of sitting down.

Chairs!

The player moves around a chair


The way this has been implemented makes use of setting the tilemap renderer's mode to "individual", which allows each tile to be rendered independently. In the project settings, the transparency axis has been set to Y=1, Z=-1, which essentially means that objects with a higher Y value are rendered first, and objects with a lower Z value are rendered first. Despite only being a 2D game, the Z axis is used so that overlapping tiles (such as the seats of the top chairs and the top of the table) are rendered in the correct order, whilst still being on the same sorting layer so that the player can interact with them dynamically. It was a difficult process to find a solution that works well, however it has (hopefully) been set up in a way that, as the world is expanded, proper rendering orders can be defined with minimal time and effort.


Also shown above is the animation of the player movement! In order to simplify the process of creating walking and standing animations for every single character, I made use of a workflow found in this article. The character spritesheet is imported into a nifty little program called Aseprite, which allows me to 'tag' each sprite into which animation(s) it belongs (Aseprite is also an editor, and I may use it to create my own art later down the track.) An example of this process is shown below

Tagging the sprites in Aseprite


The Aseprite file can then be imported into unity using the Animation Importer Script. This script reads the file, creates a spritesheet, correctly divides it and then creates animation clips as defined in the Aseprite program. Doing this automatically saves a huge amount of time and will prove immensely useful as more characters are added to the game.

Art Sources

Player: https://opengameart.org/content/24x32-characters-16x16-tiles

Tavern: https://opengameart.org/content/medieval-tileset

Leave a comment

Log in with itch.io to leave a comment.