So I started working on a new side project, a 2d top down “rpg” I’ve lovingly titled 2dpg (working title, obviously). I’d like to tell a short story in the form of one of these games, It’ll be nice to see how far I can get. I’ll try to keep these update with new stuff I’m adding and some insite to how/why.

Current Progress



Github

Movement

I’m using a rigidbody for the players and enemies, although I’m moving both of them a little differently. For the player I’m using rb.MovePosition so the control is more snappy, while I’m using rb.AddForce to move the npcs so the player can push them around and stuff. I’d like to use AddForce or something similar with the player so I can use other forces to knock them around easier, but the controls feel too floaty, like you’re walking on ice, so I’ll stick with MovePosition for now.

The player has a roll ability to dodge out of the way of attacks. This will mostly come into play in the boss fight(s?) but is also a fun way to move around. There is a stamina meter that drains when you roll so you can’t do it forever

Health

Health for the most part is normal and boring, but I thought I’d do something interesting with it too. When you do something to regain your health, like drink a potion (not in game yet, but hopefully soon), if the health you would regain would put you above max health, you get overflow health instead of it going to waste. So if you’re at 95 health (100 max), and drink a potion that heals 10 you get 100 health + 5 overflow health.
overflow
The pink bar is your overflow health.

Overflow health works a bit differently than normal health as it drains over time. Not too quickly, but enough it won’t last super long. So the idea is you don’t have to worry about wasting potions if your health is high, and you can boost your health a bit before a fight if you’d like.

Dialog

Dialog is interesting, a while ago I came up with a solution for a gui based dialog tree system that uses Unity’s Animation State Machine. GUI based as in you use the animation state machine gui to lay out your dialog. alt text It works pretty well and is easy to implement and use. I improved upon it in for this project and plan to use it for the game. I haven’t used it too much yet, so I’m sure there’s stuff I’ll change and I’ll probably end up making a whole post about just it.

Tiled

I started using a program called Tiled to layout the map instead of Unity’s tilemap editor, and it’s pretty great. I’m using the SuperTiled2Unity plugin from itch.io to import saves, and again works really well. After some experimentation I’ve ended up with a handful of layers, mostly for getting the interiors to work in a way that you can just walk into buildings and not be moved to a different map. So I seperated it into basically a base layer, and front wall layer, and a roof layer. The roof and front walls get disabled when you enter a building allowing you to see inside, then get re-enabled when you leave.