Week 2: More Stuff!


Given that this game doesn't follow the regular weekly development format, this week I worked on a lot of different feature implementation instead of level blocking, as that will come much later once everything else is made. Everything I'm making for this game is made so that it is scalable and modifiable so that when I start to make the scenes later everything can basically be drag and drop with a little bit configuration.

 

Projectiles

The most major feature for this week was projectiles, adding player combat to the game. The fireball projectile was animated using a sprite sheet from NYKNCK that can be found here: https://nyknck.itch.io/fireball-animation. The PlayerController has a SpawnProjectile function that is called when the attack button is pressed, it creates the projectile from a prefab at the player's muzzle location. The projectiles velocity is then set using the moveSpeed from the prefab and direction the player is facing. When the projectile collides with a player it calls the players TakeDamage function which decreases their health and then destroys itself. The projectile will also destroy itself after a short amount of time if it doesn't hit anything.

 

Fig 1 - Player shooting a projectile

Health

Each player has their own stats for current health and max health. Their current health is affected when TakeDamage function is called and a check is done to see if their health is at zero, if it is, the OnPlayerDeath function from the PlayerManager script is called, this adds score to the attacking player and updates their score UI, as well as decreasing the attacked players lives. It also calls the SpawnPlayer function which moves the player off screen, waits for a second and then places them back at one of the spawn locations while also resetting their health to max.

Fig 2 - Player health and lives getting decreased and score getting increased

Lives

When a player loses a life, a check is done to see if they are at zero and if they are it freezes the game and brings up the game over UI which displays who won, the final score and play again and main menu buttons. A player can also die by falling off the map and the score will be attributed to the last player to attack them, if no one has attacked them yet it doesn't add score to anyone.

 

Fig 3 - Game win and game over UI

Knockback, Hit Animation and Damage Flash

when a player is hit by the projectile a small amount of knockback is applied which moves them backwards and up from the direction of the projectile. It also plays the hit animation from the sprites mentioned in the previous devlog. The DamagFlash coroutine is then called which sets the players colour to white and then back to original to give the player a bit more visual feedback that they got hit.

 

Fig 4 - Knockback effect, hit animation and damage flash

Map Zones

This week also saw the addition of the first two map zones, slow and weak. Both zones use colliders set as trigger and sprite renders to give a visual representation of the zone. Each zone has its own script to apply the effect. The slow stores all the players movement stats when they enter the trigger, so moveSpeed, jumpForce and downForce. It also has variable for modifier values for all of them so its customizable. It then applies the modifier to the player stats and on exit resets them to the original. The zone featured in this build halves the players movement speed, but the zone can be configured for many different effects. The weak zone sets a bool in the player for weakness as well as modifier, when a player enters it turns on weakness in the player which causes an if-else to use the modifier otherwise the player will just take damage normally.

 

Fig 5 - Slow zone effecting the player

Fig 6 - Weak zone effecting the player

Charge Shot

The charge shot makes it so after a short amount of time the player's shot will go faster and therefore further before it despawns. This works by using a timer function that is started when the player starts holding the attack key, when the player passes the time threshold, they will turn yellow, so they know they're charged and then on release of the key they turn back to their regular colour. Now the charge shot is only to make your shots go further but, in the future, may do more damage.

Fig 7 - Player shooting charged shot

Feedback

Players found that CTRL and W closes a tab on basically every web browser, so the red player's attack button has now been to right shift.

Quinn found that going Fullscreen on his computer cropped the game massively, currently the game is locked to 1080p, scalability of the window will be address in the future once camera control is added.

Addison brough up the idea that the player's vertical velocity should affect the players projectile, So I added that in, now when the player is jumping their shots will move in an upward angle and when falling, they move at a downward angle.

Fig 8 - Player shoot vertical velocity affected shots

Some other bugs were also bought up about how lives were decremented when taking damage vs falling but that has all been fixed now.

Leave a comment

Log in with itch.io to leave a comment.