Asteroids with help with chatGPT
I made another thing today. This time I had the speccy game Thrust in mind. However, as these things go, it eventually turned into Asteroids.
Again I used chatGPT to get the ball rolling by first asking for a Spaceship class to be generated that consisted of a triangle, a velocity and angle. It made that with ease, so I then asked for it to be rotatable by using the arrow keys, then thrustable by using the up key. I then asked for an asteroid class by asking it to make a class that created a random irregular polygon, again with a velocity.
It started to get complicated after I asked for projectiles then are emitted in the direction of the spaceship. So at this point I manually rejigged all the code to use inheritance and submitted the entire code back to chatGPT. Then I asked for collision detection but because each objects wasn't using vertices (projectile was a rectangle, ship a triangle) I had to convert it first. Then it was just a case of asking for a function that checked two objects to see if any lines (based on given vertices) crossed. It worked first time and I didn't have to relearn some maths!
It needs some tweaking and maybe I'll add touch controls...or get chatGPT to add them anyway!
Play the pointless crap here
It started to get complicated after I asked for projectiles then are emitted in the direction of the spaceship. So at this point I manually rejigged all the code to use inheritance and submitted the entire code back to chatGPT. Then I asked for collision detection but because each objects wasn't using vertices (projectile was a rectangle, ship a triangle) I had to convert it first. Then it was just a case of asking for a function that checked two objects to see if any lines (based on given vertices) crossed. It worked first time and I didn't have to relearn some maths!
It needs some tweaking and maybe I'll add touch controls...or get chatGPT to add them anyway!
Play the pointless crap here