The developer encountered a bug while animating the character's death animation upon touching a snake in the game. The timer that triggered on collision allowed the character to still move despite starting the death animation. To fix this, the developer updated the movement rules so that movement only occurs if the "Life" attribute is greater than 0, preventing movement during the death animation. For future improvements, the developer proposes allowing the character to bounce back upon first collision, giving a second chance to dodge before triggering the reset. This would make the game less frustrating.
Disha NEET Physics Guide for classes 11 and 12.pdf
Bug and fix
1. Snake Escape - GameSalad Bug & Fix
I came around a bug within the game when I was trying to animate the character (Jimmy) when he
touches a snake (the death animation). I created a timer that would trigger when Jimmy touched
the snake. The timer looked like this (The behaviors missing at the bottom of the screenshot are
“Destroy Actor” and “Reset Scene”).
This timer means that when Jimmy touches/collides with a snake, for 3 seconds the attribute “Life”
will change to “0” and Jimmy will animate the death animation, after 2 seconds the attribute “Life”
will turn back to “4”, the actor will be destroyed and the scene will reset. This timer however had a
major bug. If Jimmy collided with the snake, the animation would play, but it Jimmy was still able to
move around using the arrow keys, and if Jimmy passed through the snake before the 2 second
timer (The secondary timer inside the main timer) started, the game wouldn't reset and Jimmy
would still be alive.
I fixed this by adding a simple behavior to the arrow key rules for Jimmy. Here is what it initially
looked like (This is an example of the “Up” arrow key):
Here is what I changed it to (The “otherwise” panel is hidden but is the same as previously):
2. Snake Escape - GameSalad Bug & Fix
As you can see, I changed the rule of movement. I made it so “If the Up key is press down AND
the attribute “Life” is more than 0 (meaning if he is alive), THEN move upwards. I applied this small
rule to all of the arrow key rules, which means if Jimmy makes contact with a snake, he cannot
move as the “Life” attribute falls to “0” as soon as he touches the snake. This fixed the issue of
passing through the snake and staying alive.
How could I make this better next time?
The hardest part about the game is that if you do not dodge the snake in time (which is easy to
do), you stop moving and then restart the whole level. This can become very annoying as you can
be cautious throughout the whole level, then end up slightly mis-timing your dodge and ending up
restarting the whole level again. Next time, I should make the game so that when you hit a snake,
Jimmy would bounce back a few feet from the collision point, giving him the chance to dodge the
snake a second time. If they fail to dodge the snake a second time, jimmy would play the death
animation and reset the scene, just like it is now. This could make the whole game a bit more
enjoyable and less frustrating. I could also clean up the rules and behaviors within the timer as it
isnʼt efficient and is messy.