The last few days I have put a decent amount of effort into my little side-project game, and I am super-happy with the progress I've made.
I've added a bunch of screens including a loading screen (blink and you'll miss it since there aren't many assets to load), a menu, credits, high scores (instead of the list that lived outside the game before), and instructions.
I've also separated the in-game UI (currently just the score) from the gameplay code, plus added a "game over" overlay when you die.
The most important change (from a developer's perspective) is that I've modularized the code considerably.
Each of these screens and overlays, plus a high score service that handles saving and loading the scores and giving them to both the game over overlay and the high scores screen when requested, are all implemented as separate classes, each in their own file.
I've also made a custom base class for any screens that have buttons, so button behaviour is reusable and only ever needs to be changed in one place.
The player is also implemented as a separate class, but most of the player behaviour is still stuck in the gameplay code. I will need to separate that out, and I haven't done anything yet about splitting out the code for monsters or the things you collect.
I also fixed my first real bug - you can no longer jump off collectibles if you collect them by landing on top of them.
The original code was checking for player.sprite.body.touching.down
when determining if a player could jump, which returns true if the player is touching any other game object. Changing that bit of code to check player.sprite.body.blocking.down
ensures that you are touching a static body like a platform.
For a while I was considering collectible jumps as a feature, but no, it doesn't belong in my final vision for the game.
And, of course, I replaced the assets that had licensing issues.
For now it isn't mobile friendly because I haven't done any work in that direction yet. The menus will work fine on mobile, but the game itself will be unplayable. However it works fine for anyone with a keyboard, so please check out Witch's Brew!
The original version is still available for a while for the sake of comparison.
What next?
I still have a lot of plans for this game, and I already have a pretty good vision of what I want the final game to be.
Short-term I want to do the following:
- Move all the player behaviour into the player class
- Create a base monster class with their shared behaviour
- Create separate monster classes with individual behaviour that will extend the base monster class
- Create a separate class for collectibles
- Change each collectible's point value based on type
- Add a way to pause the game
- Play around with the physics configuration because I'm not happy with how the witch "floats" when you jump
- Tweak the hitboxes of the witch and monsters - for now they are all just rectangles trimmed tight to the visible "body" of each entity, but this allows situations where you'll die from a point near your hat hitting a point near a ghost
- Determine how best to handle different screen sizes and aspect ratios
- Add mobile controls
- Add a few more level layouts and randomly select one when you start a new game
- Have a think about the game's name (still not sure if I like it)
- Create a nicer logo
Most of those things don't expand the gameplay so much, they are more about preparing for my later changes - a health mechanic (instead of game over as soon as you touch a monster), recipes you are trying to complete, some power-ups, a few more monster types, audio, and a bunch of other crazy ideas.
Finally, if someone can do me a favour.....
Running the game remotely in Brave I see all text objects offset down the page by a considerable amount, yet running it locally in Brave or running it remotely in Chrome and Firefox, it appears fine.
If someone could confirm they are or are not seeing the same thing in Brave this will help me figure out if it is a problem on my end, or a Brave issue so I can report it:
Edit: Issue solved - if anyone else has a problem like this in Brave you can fix it by disabling fingerprinting protection for the site, which is breaking some aspect of WebGL trying to write text to the screen.
If you are worried about being tracked by turning off fingerprinting protection I can guarantee that the game has no tracking code involved, but if you visit any other part of the site Google Analytics will be loaded, so turn your fingerprinting protection back on before you go anywhere else in the site!
Edit 2: This seems to be fixed in Brave 1.11.101, so make sure your browser is updated and you shouldn't have to turn fingerprinting protection off!
Thanks!