Upgrade mechanics


Basic interactions:

The controls so far are: 

  • WASD for 8 way movement
  • Left click for sword attack (subject to change) and to interact with buttons
  • Right click for ranged attack
  • Space to pick up items  / buy upgrades

Although this system works I may move the sword attack to space and the item pick up to 'E'. Might also hotkey the inventory button to 'I' if I figure out how.

This game uses the font "Somerset Barnyard Font" by Chequered Ink, found here. I think this font suits the game style very nicely without just being pixel text.


Testing/Feedback 

The interactions remained mostly the same between the last two builds, just adding in the money and upgrades systems. Things work as planned which is a good sign. The next few weeks will be a lot of polishing.


Plans checklist (in order of most important)

  • Shadowmen don't stop moving if you pause (need to fix)
  • Player health/player takes damage
  • Controls screen/finish the 'swap' screen
  • Music/ Sound effects
  • Chests/bushes in the forest (maybe)
  • Visual effects e.g bats cause blindness when in range of the player, coin pick up sparkles, item sparkles, shimmers on upgrades you can affort etc.
  • Change attack key (maybe)


Finished since last update 

  • Main menu/ HOME screen
  • Forest UI 
  • Money system
  • Sell screen
  • Finish drawing other sprites
  • Make the shadowman initially move towards the player after it spawns 

Bug fixes: 

  • Fixed a few typos in the display of 'coins' coming up as 'coinss'
  • Removed most of the testing items off the ground


Implementation 

The typos were easy to correct, just changed a few values in the variables script tied to the variablesaver object that doesn't  destroy on load. The shadowman change was a very easy change, setting the 'isNear' value to true on startup, so that it can move towards you and if you run away or hide, it will stop.

The main menu screen was made by sending my drawing (the thumbnail of the itch.io page) through a pixel art generator, and restricting the colours to a few brown/green tones. Then I just added few buttons on top that link to different scenes. 

The final product looks like this: 

First, I implemented Money/coins. I drew a sprite and created a prefab object for enemies to instantiate on death with  random 'value' number of coins. When picked up, instead of counting as an inventory item they just get added to your total coin count. The coin count was added to the inventory/pause menu so it could be seen. 

I also made a sell menu in the home screen, with buttons that sell every item if a specific kind in your inventory, and gives you back money and frees your inventory. 


The home screen is a bit more complicated, with 4 structures each requiring money upgrades to unlock better stats for the player. These stats are unknown to the player as of yet, but this will change within the next few updates. 

A video of the gameplay (where i cheat in a bunch of money to showcase all sprites):

The implementation for this screen was a bit challening, i first created a script for setting the sprite that I could place on every building just changing a name string and sprite[] array, and then writing a method to set the sprite that depended on the building level, a number which would be stored in the variablesaver. This way any time the scene was loaded, the game would already know exactly which sprite to show on the building. 

This was then build upon with custom colliders for the sprites, and another script to give the buildings a more 3D effect that would change the layer order of the gameobject depending on if the player had a y valye of lower/higher than the sprite's pivot. 

After this, I created a new gameobject with a hover script just like the items, and a buy() function instead of a pickup() function. The buy() function would first check the player's money against the cost of the upgrade, then if you have enough money the sprite and collider will be updated. 

Then, I wrote other scripts to set certain variables equal to certain numbers (e.g. inventory max size, player hitpoints, spawn rate/drop chance etx.) depending on the levels of each building. These would be updated alongside the Buy() function. 

The buy button also has a mini worldspace canvas that displays the cost in coins. This was challenging to figure out since there were some wacky scale issues but once i made one it was easy to duplicate it. 

I then added the coins/inventory to the general UI. I think i have to fix this in the forest but i'll get to that once i make the health bar.


I finished drawing almost all other sprites, the only ones left are the optional chest/key/bush. 


Files

Build9.zip 8 MB
Sep 26, 2021

Leave a comment

Log in with itch.io to leave a comment.