09/24/2024
Making some fun progress on the game today. I had chatGPT keep moving the crosshairs after a direction button press. The enemy looks a little better. A score system was added, along with hit detection for the lasers.
"uh-oh, something went wrong. All I see now is a black square in my browser!
ChatGPT said:
ChatGPT
It looks like the code might have gotten cut off while I was adding the updates for the score and laser collision detection. Let's correct that and ensure the game functions properly. Here's the fixed version of the full code, with all the updates:"
We had some problems with the code, chatGPT was re-writing the entire thing every time I had a change. I instructed it to just provide me with new code for whatever function it was updating, like:
// Update the rotor animation by cycling through rotor states
function updateRotor() {
rotorIndex = (rotorIndex + 1) % rotorCycle.length; // Move to the next state in the cycle
rotorState = rotorCycle[rotorIndex];
}
And now we've got a score keeping and an explosion animation!
Try it out here, arrow keys and spacebar are all you need.
https://chopperassault.com/code-tests/chopper.html