Making of LLemMings

Keeping track of score and level goal checking

ChatGPT: Prompts below


Human notes: This should actually not be called score, as it is just
about checking goal(s) of the level. There should be a _real_ score
later on which also give you some kind of bonus for saving more
creatures/resources than the designated goal was.

But fine. Later.

>>> Prompt 1: the check
Given this partial game object:

class Lemming {
constructor(x, y) {
this.id = -49152;
this.width = 10;
this.height = 20;
this.x = x;
this.y = y;
this.velX = 0;
this.velY = 0;
}
}

and this structure in levelData:
"finish": {
"x": 750,
"y": 480,
"radius" : 100,
"clear": true
}

I want a function to check whether a lemming reached the finish area.
You can use manhattan distance.

In the update loop, check whether lemming reached its finish, if it was,
increase score by one and set a new property in the lemming that it was
rescued.

>>> Prompt 1; "UI"
We're making a game using Javascript and canvas, we need to do score keeping.
Give me a class which keeps track of score and updates UI when score changes.
The UI can be an HTML element position in the top-right of a passed in canvas

>>> Prompt 2
Make the HTML element a bit fancier, like give it a round transparent
background and remove the word "score". You cannot use any third party
libraries, but make it look fancy.

>>> Prompt 3
Give the text some shadow effect

>>> Prompt 4:
Give me a name of some standard whimsical font that can be used for a game.
>>> ChatGPT: One standard whimsical font that can be used for a game is "Comic Sans MS".
>>> Human: OK! :-)