Invincibility Frames
Date: July 31, 2024
Hey everyone,
I've been working on refining the gameplay experience in Astro-Metry, and I wanted to share a significant update that addresses a frustrating bug I encountered. Here’s a quick rundown on what was happening and how I fixed it.
The Issue
While testing the game, I found myself getting trapped in the pathway of an asteroid a few times. This led to an instant loss of all my hearts as the asteroid rammed into my character over and over. It was a frustrating experience and made the game feel more punishing than intended.
The Solution: Invincibility Frames
To tackle this issue, I implemented a system of invincibility frames. Now, when the player gets hit by an asteroid, they become invincible for 1.5 seconds. This temporary invincibility prevents multiple collisions in quick succession, making the gameplay feel more fluid and forgiving.
Implementation Details
Here's how I added the invincibility frames:
- Collision Detection: When the player is hit by an asteroid, the game triggers a hit event.
- Invincibility Timer: An invincibility timer starts, making the player immune to further collisions for 1.5 seconds.
- Visual Feedback: During invincibility, the player character flashes to indicate the temporary invincibility.
- Reset: After 1.5 seconds, the player can be hit again by asteroids.
This change ensures that players have a fair chance to recover and avoid instant heart loss, making the game more enjoyable and less frustrating.
Feel free to try out the new update and let me know how it feels. Your feedback is always appreciated!
Happy gaming!
Leave a comment
Log in with itch.io to leave a comment.