A JavaScript Game I made - D20 Gambit

Hi All!

I’ve been building a game, based on a DnD casino game, would love to get your feedback!

(The CSS is trash, this one is all about the JS)

game: D20 Gambit
code: GitHub - AidaP1/d20_gambit

The Javascript seems very… sprawling. I have a huge number of functions and variables that feel like they do quite similar things, but I’m not sure how I would rationalise it.


Yes factoring is definitely good practice for this type of thing. I would consider rolling the player/opponent into one thing for example.

That is a good shout, thank you. I initially did that in case I wanted to add more opponents, but it proved a little complex…