Making of LLemMings

Initial work on Digger/Miner/Basher

ChatGPT: default settings


The code 'compiles' but it does not yet properly work, it seems.
I will probably return with refined prompts.

>>> Prompt:
We are making a game with lemmings. There are three similar types of lemmings:
- Basher - The Basher will at when encountering an obstacle it cannot traverse, instead of turning around, carve a tunnel in front of it. That is, remove pixels in the background. The height of the tunnel is the same as the height of the lemming (+ a few pixels maybe)
- Digger - The Digger works almost the same, except that it will not wait for an obstacle before it starts digging. It will immediately start digging straight down. The hole it digs is a few pixels wider than the lemming is wide.
- Miner - The Miner works almost the same as the Digger, the only difference is that it will dig a tunnel diagonally downwards. The size of the tunnel it is digging is 150% of the height of the lemming.

They all need to be on the ground to be able to dig. They should keep on digging until they cannot dig any more (that is, they are now where there is no surface).
Remember that they dig over time (no instant tunnels), they all dig at pace of around 20% of the normal walking pace.

For context, I give you the following code, which is the Lemming (object):

... <> ...

Reuse functions where possible. If you use functions that are not in the snippet above, give me those as well.

You can find out what type it is by looking at the "action" property of a lemming.

Remove a pixel from the canvas using, e.g.: background.data[(y * canvas.width + x) * 4] = 0;
Remember to restore canvas with something like this every frame: ctx.putImageData(background, ...)

Give me only code, I don't need explanation.