Alzter / TuxBuilder

A Godot re-implementation of SuperTux
GNU General Public License v3.0
212 stars 28 forks source link

Add invincibility Star and change stuff #25

Closed skyace65 closed 5 years ago

skyace65 commented 5 years ago

I added the invincibility star to the game and overhauled how invincibility is done. Here's a list of changes and I'll go over the new system at the end

-Added invincibility star -Added a folder in sound effects called bonus and moved several things there

Player -commented out disabling hitboxes in func_kill(). I did several tests and the code didn't seem to make a difference. If it is actually doing something please let me know before adding it back in. If not just delete it -overhauled invincibility system -added a second animation player for when the player is invincible -made invincibility timer based

So here's how the new system works. When the player touches a star it starts the star_invincibility() function. if the player is damaged it starts the damage_invincibility() function. Both functions play their respective animation, set how long the invincibility timer will last, make the player invincible and start the timer. When the timer is finished it turns off invincibility.

A second animation player was necessary because if you try to use the regular one another animation like jumping cancels out the invincibility animation, the second player lets both animations happen in parallel.

Invincibility uses 3 variables. invincible which is used when the player uses the star or is sliding. invincible_damage for when the player is hit by an enemy. and using_star for when the player is using a star. The only reason I made this variable is so invincibility can be reset in physics_process() when the player isn't sliding. So if the player isn't using a star invincibility is set to false, if they are using a star it isn't.