Making of LLemMings

Bomber!

ChatGPT: A new green-blue block type!


>>> Prompt 1 (the bomber):
We are making a game with lemmings. A specific type of lemming is a Bomber. When a lemming is assigned to be a bomber,
it should stop moving and then blow up and create an random, organic looking hole at it's location -- the lemming will die from this. The hole
it leaves after should be carved out by clearing pixels in oldImgData.

A lemming looks like this:
... lemming implemention as it was ...

Create a function that creates the hole.
I also need the logic to add to Lemming's update function.

I don't want pseudo-code, I want real code. And only code, no comments. If you need to create functions not declared
in the snippet I gave you, implement them and show them to me.

>>> Prompt 2 (the hole):
On a byte representation of a canvas (RGBA), given an x and y position, an explosion creates a hole. It clears
all pixels (set them to black) in an area of say 50 by 50 pixels. The edges of the hole should look a bit rough
and random, a bit spikey even -- not just a plain circle.

At your disposal you have a perlin noise class that is global called 'noiseGenerator'.
It can be used like this, for example:
noiseValue = noiseGenerator.noise(x * noiseScale * frequency, 0, 0) * 0.5 + 0.5;

You can't use any canvas drawing methods because we only have arrays, so use direct pixel manipulation on the data
that you can get with getBackground() which got its data from this: ctx.putImageData(background, ...).
You can get to the width and height of the data by using the global variables canvas.width and canvas.height.

Since the hole will affect collisions, you also need to clear the same pixels in oldImgData which is
also originally from ctx.putImageData(oldImgData...).

Don't use any local variables called oldImageData or newImageData as that is very confusing since there are global variables
with similar names. (that you picked, I might add)

If you want to go fancy, you only update the area that needs updating instead of the entire canvas.

Make it a function like this: createHole(x, y, holeSize = 50). I don't need any explanations, just code.
Note that the x/y that are passed in might be doubles, make them ints.

>>> Catch-up notes:
Backup was named: '_index - Copy (47) - A passable bomber.html'
Associated LLM context: n/a