I made a game called Protect Your Computer, and the objective is to try to destroy the virus (bean) and click extra popup windows.
I tried to make the bean show on top of the popups, but the popups are still at the top, even though I used layers. Are there any problems with the code I wrote, or problems with Kaboom?
Repl link: https://replit.com/@OnlyAHuman/Protect-Your-Computer?v=1
I wrote the layers this way:
layers([
"bg",
"play",
"popup",
"scoreboard",
"viruses"
], "play");
this.body = add([ // this is the virus object
sprite(this.sprite),
pos(Math.random() * width(), Math.random() * height()),
area(),
layer("viruses")
]);
let popUp = add([
sprite("popup"),
...
layer("popup")
]);