Devlog 27 : Added IFrames To Dodging And CoolDown UI

Now the player will not take damage in a middle of a dodge. As seen below, I was able to dodge through the first bullet but was hit by the second one that came after.

This will only apply to projectiles and not the enemies themselves. If the player touches a ship, damage will be taken.

(Enemy art wip)

Inputs for Dodging

Nothing too fancy. If the player pushes left shift, I’ll call coroutines, set my dash duration bar to full, and set Canboost to false.

The “_dashslider” is a slider that tells the player that the dash ability is on cooldown.

Dash slider on the right filling up and decrementing

These boxes represent the players set of abilities and their buttons to active them. They’re empty for now, and will have icons to represent each skill. they’re will be 3 skills in total.

The Coroutines

I have three variables to keep track of the players speed.

An int Basespeed which will retain the players current speed.

A Int speed variable that is volatile and will be used for the players movement speed.

A int Dashdistance that is used to measure how far the speed can be amplified during the dodging process.

Boost Coroutine

The first coroutine that will be called when the player pushes shift is the boost coroutine. Boost will amplify the players current movement speed until it reaches a max value (DashDistance).

During the time that the players speed is being increased, Isdodging will remain true. This boolean is what keeps the player from being damaged.

Decelerate Coroutine

Once it the players movement speed has reached the max value. It will then call a coroutine to decrement the players speed to its original movement speed. Once the player has reached original speed, isdodging will be set to false.

Taking Damage

A condition statement for isdodging will encompass all of the lines written within it. If isdodging is true then the player will not take damage, else then yes.

However I have a created a separate function for when the player dodging into the enemy itself.

in my enemy script, the trigger will check if the enemy has made contact with the player

The enemy will call the separate function made within the player script for collision damage. Which is conviently called CollissionDmg.

Dodge Cool Down

A coroutine handles the timer and visual representation of the dodge cooldown.

This is called immediately when the player pushes dodge. It’ll decrement the slider until it reaches zero and then set the canboost boolean to true. Which the name implies, allows the player to boost.

Now I can weave through bullets just like in games such as enter the gungeon



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vixian Phimmasone

Vixian Phimmasone

Unity Developer Based out of California