if statement fails randomly but works most times
Posted: Thu Jul 07, 2022 10:59 pm
Hello, im new on the forum and with love2d in general, but i have intermediate coding skills.
So basically, I have expanded on a game that is made in the following tutorial: (http://osmstudios.com/tutorials/your-fi ... -exercises)
I added many changes and features which u will be able to read about on the first line of my main.lua
In the game, after the player dies, there is a prompt that tells the player to press 'R' to restart. This is completed through an 'if' statement in my love.update function (line 192).
In the original iteration of this games code, i never seem to run into any problems, however, on my iteration it fails every so often while I'm playing the game. This is regardless of the fact that i barely even touched this section of the code, I only added a line at the end that resets the players health.
Also, sometimes I respawn with 3 health when its supposed to be 4, and I feel like sometimes the asteroids spawn outside the screen but I'm not sure if I'm just tripping?
Can anybody help me figure out whats causing these bugs? I'm pretty sure its a simple fix but I can't quite put my finger on it.
I attached my .love file below, Thanks!
So basically, I have expanded on a game that is made in the following tutorial: (http://osmstudios.com/tutorials/your-fi ... -exercises)
I added many changes and features which u will be able to read about on the first line of my main.lua
In the game, after the player dies, there is a prompt that tells the player to press 'R' to restart. This is completed through an 'if' statement in my love.update function (line 192).
In the original iteration of this games code, i never seem to run into any problems, however, on my iteration it fails every so often while I'm playing the game. This is regardless of the fact that i barely even touched this section of the code, I only added a line at the end that resets the players health.
Also, sometimes I respawn with 3 health when its supposed to be 4, and I feel like sometimes the asteroids spawn outside the screen but I'm not sure if I'm just tripping?
Can anybody help me figure out whats causing these bugs? I'm pretty sure its a simple fix but I can't quite put my finger on it.
I attached my .love file below, Thanks!