Share your repls and programming experiences

← Back to all posts
Collect the Coins! Beware of the Barbarians! Save Yourself by Sticking!
RoyalCoder1234 (35)

Hello!

Thank you for checking out this game. I hope it is not too hard. Comment if the game has bugs and if you can finish all of the 14 levels. After 14 levels, you will be sent back to the first one.

If you upvote, thank you!

Comments
hotnewtop
Coder100 (17077)

Nice! Just the alert boxes are way too annoying, please use something else ;)

19wintersp (1120)

alert() and prompt() are blocking functions, which means that nobody can do anything until they've clicked OK. I suggest making your own popup which appears at the bottom of the screen and doesn't stop input.
For example, you could do something like

<div style="position:fixed;bottom:0px;width:100%;background-color:white;">Text here</div>
Coder100 (17077)

so it would also affect gameplay too, forgot to mention that,
but ig you could make an async alert (i think):

async function asyncAlert(txt) {
  return new Promise(() => alert(txt));
}

@19wintersp

19wintersp (1120)

@Coder100 I think that alert() blocks the entire renderer and event loop, so even async won't work.

19wintersp (1120)

@Coder100 I think it just uses divs which have position:fixed; and some high z-index value. You could make it so that they appear and flash or something.

Coder100 (17077)

@19wintersp yeah, im sure i can implement it with more modern features

Coder100 (17077)

or maybe royalcoder could just implement this in p5:

rect(0, 0, 20, 20);
// ...

strange that he didn't and chose to hurt us
@19wintersp

Coder100 (17077)

maybe that's the point...
survive so you don't get annoyed
lol @19wintersp

19wintersp (1120)

@Coder100 A good incentive to boost scores ;)

RoyalCoder1234 (35)

@Coder100 I'm not that good in promises and async functions, but I will see if I can learn it better.

RoyalCoder1234 (35)

I have added the div alert thing and pushed the about stuff into the HTML file. If you can't see it, check line 486 to 505 in the JavaScript file.

RoyalCoder1234 (35)

Thank you for those comments! I will see if I can build something that doesn't stop the whole program.

TANMAYBAGADIA (48)

Yaa use a div for the instructions or use iframes in which u wrote , nice game :)