Spawner, an Ability, and some Pickups

Overview

Since my last update, I have made a bit more progress with some new systems and mechanics as well as some bug fixing. I want to go over a couple of them here which are going to be used often during play. Enjoy!

 
 

Bug Fixes

As I was adding in doors and keys, I have actually ran into a issue with my player movement on the grid. I had to spend some time trying to pinpoint what exactly was breaking the players movement. I found a bug when placing a door on the grid it was not being checked properly as a unwalkable area. So how I fixed this was having the grid cell do a raycast and check what type of object is on that cell. If that cell has a door or an obstacle, it is marked in my grid system script as unwalkable.

Another bug I had was when trying to unlock the door, it was checking the position of the door and moving the player at the same frame. This was not intended and I wanted the player to not be able to move if there is a door being unlocked. So how I fixed this was by doing a check for the target grid position before moving to that cell. If the position is a door, and the player has a key, it will consume a key and unlock the door but not move the player.

Below in the image is a code preview of how I am handling my raycast from my grid cell. I have two functions currently, one checking for a door and one checking for a obstacle. This happens when the cell is spawned on the grid and the position is then stored on my grid system script for the current level. These two functions will probably be refactored at a late date as I want to make a single function to handle various checks for a layer mask. For now, I got the system working great and on to the next mechanic!

Spawner System

I made a spawner system for the game to spawn a object in the world and move that obstacle in a certain direction. I made this able to spawn more than one type of projectile from the spawner. So if I wanted various types of projectiles being spawned from this specific spawner I can add them to my list and it will spawn them. Yay!

I also was thinking about performance as I was creating this system, so I decided to go the route of creating an object pool for my projectiles. This helped decrease the amount of projectiles being instantiated in the game by just enabling and disabling the same ones in a list of projectiles, and once this list has all been active at once, I have it add 5 more projectiles in the pool of projectiles.

In the picture below, the red and orange circles are my testing projectiles being spawned in the game. Currently I have them going from left to right, and the other from right to left for a little variation.

Invulnerability ability

I wanted there to be something in the game to allow the player to bypass some damage for a given amount of time. So the idea of a ability to allow this came to light. When planning this ability, I took in consideration a few questions.

  • How to Use?

    • The player will use a assigned key to use this ability.

  • When can use?

    • I wanted this ability to be only used when charges are available.

  • What does this do?

    • This ability will stop all incoming damage for the player for a certain amount of time.

  • How to obtain charges?

    • Charges are obtained during play as a pickup item for the player.

In the pictures below I am showcasing the player character using the Invulnerability ability. When the player uses the ability, a blue shield will animate around the character as a visual indication for the player to know it is active.

I also made a UI for knowing how many invulnerability charges are currently available. When obtaining the charges on the ground, it will add to the players current charges.

Pickups

This mechanic is much easier to explain, its a item that’s in the game and once the player collides with the pickup, it is added to the players ability or stats. The three types of pickups that I have made so far is a life, a key, and an invulnerability charge pickup.

The key will add a key to the players key inventory unless the player is at maximum amount of keys.

The life pickup will add a life to the player unless they are at max lives already, then the pickup wont allow the player to pick it up.

The Invulnerability charge will add to the players current charges, unless the player is also at max charges.

Below is the artwork I drew for these pickups.

Key Pickup

Lives Pickup

Invulnerability Charge Pickup

Conclusion

I had a lot of fun adding these new systems and mechanics in the game. I had some challenges to overcome and tons of problem solving was needed to work around or fix certain issues. These additions has made the game feel more alive, and fun to navigate through. I cant wait to give another update with more additions to my game. Until next time, thank you for reading!

Ryan Beattie

A game designer and developer that has a passion for creating fun experiences.

https://RyanBeattie.net
Previous
Previous

Hazards and Enemy AI

Next
Next

Project Goblin - Grid & Movement