2/10/25 I added the enemy NPC to the background and started working on creating an Enemy.js for all enemies such as the spider and the bat.

Image

I copied the Enemygoomba.js file from platformer4x to get an idea of how I should make the file and after copying it I changed the name to enemy.js and I started working on the code to make it work the the adventureGame.

Image

Plans:

  • Add the ending level with the butterfly npc
  • Finish enemy.js
  • Add boundary restriction for the chillguy aka the player.

During the time of when this was blogged the enemy.js was not working correctly as of the latest update enemy.js has been changed completely and is now working perfectly Enemy.js & enemy class 2/9/25 to 1/10/25 Image I created an enemy.js file and defined an Enemy class. Then, I extended this class to create specific enemy types, such as Bat and Spider.

Spider.js and web shooting Image I created a Spider.js folder so that I could change the behavior of the Spider enemy so that it attacks you when you approach it. The code written in this shows that the spider can jump 30 pixels high once you go near it so creating the Spider.js file and modifying the behavior of the Spider enemy, makes the game more interactive and engaging. The Spider no longer just sits idle; it becomes a dynamic threat that reacts to the player’s actions. I also plan on making the spider shoot webs at the player.

Image

the image shown above is that one that I want to use for the spider when it shoots the webs at the player/you.

Bat.js & hovering jumps and attack Image

Just like the Spider.js I created a Bat.js folder that also extends the enemy class that is located in the enemy.js folder. however this time instead of having spider-like movements the bat stays in the hovering position as if it were flying and then jumps 50 pixels and goes back to it hovering movement. Like my idea to make the Spider enemy shoot webs, I want to be able to make the Bat enemy disappear if you manage to jump on it somewhat similar to what was in the Platformer4x game. However, I have yet to add that to the code but when I do I will reference the way that it was in Platformer4x

What it looks like in the GameLevelDesert.js*

Image

What the game looks like right now

Image

Plan for the future

  • I already created a GameLevelEnd.js and to get to the end you must make it through the Bat and Spider enemy and ask the helpful magical fish for help to find the exit once you get to the exit you will enter the end level

Image The image above is what I have so for the GameLevelEnd.js in VS code

Image Butterfly.png that will congratulate you.

Image End level background

  • Like how I created an Enemy class and extended it to the Bat and Spider enemies I want to create a allies class and extend it to the helpful fish and create a Fish.js and make the fish be able to help you more like actually giving advice.

2/13/25 While trying to make the enemy class the game started to crash so instead of extending the bat from the enemy class I changed the code so that the bat extends the character class. Now what the bat does is when you start moving the bat follows you. Image

Plan for the future

  • Make the enemy class actually work and make the spider class extend that or instead of having an enemy class just have the spider extend the character class like what I have right now.

2/14/25 Since I could not make the bat enemy and the spider enemy extend enemy.js I made them extend character.js. Now I made it so that when the bat touches you it will make you die and then you will have to restart the game. Also when you come close to the spider it jumps away from you but if you manage to catch it you will also die.

Image

Before play dies Image After dying

Ski week update Over the course of the break I have changed many of the files in the game, I was finally able to make an exit in the first level which leads you to the 2nd level. However, are no enemies in the 2nd level it is more of a “safe haven” as a reward/congratulations for making it out of the cave.

Enemy.js After much trial and error I was finally able to create the enemy.js successfully. The enemy class extends the character class and it has 4 main properties:

  • Collision
  • Explosion
  • Animation rate
  • Destroy player The Bat.js and Spider.js both extend these properties. Bat.js
  • Check proximity feature which allows it to constantly follow the player no matter where the player moves in the game
  • Jump feature from the enemy class has been left empty because I want the bat to fly/hover not jump around
  • Collision between the bat and the play results in the animation of which the player explodes and that results in the end of the game Spider.js
  • Jump feature is used when you come too close to the spider it jump away at random using X & Y
  • Check proximity if left empty for the spider because I only want one enemy to follow you around (As of now there are no enemies in the 2nd level)

NPC The NPCs are in every level and some are dangerous such as Spider & Bat. The NPC class extends the character class.

  • The NPCs in the first level are the Wizard which is also used as an exit and the Helpful Fish.
  • NPCs in the second level are the Wizard & the Hat Wizard(exit)
  • In the first and second level
  • You can only exit the levels once you go to the wizard
  • The wizard is in every level

Image

Helpful Fish

  • Once you go up to the fish it tells you what the bat can do and how to exit the level
  • Also encourages you to answer the questions

Image

Question/Quiz Based on the original code that was there for the question I created a quiz. To activate it you must press either the ‘e’ or ‘u’ key. You are prompted to answer the questions by the Helpful Fish.

Image

After pressing either the ‘e’ or ‘u’ key this is what the questions looks like.

Image

Image After answering you press submit and continue the game.

Things that will be done before N@TM

  • Addition of 3rd level
  • More NPC in 2nd level
  • Sound effects for the enemies & player

3rd level plan

  • Theme is mountain
  • The enemies will be a bear and a bird ( same properties as the spider and bat) both will also extend the enemy class that was used for the other enemies
  • The wizard will also be in this game and once you get to the wizard the game will be over
  • I plan to make the 3rd level the 2nd one that you enter and the current 2nd level the last one since it is supposed to be the end level that is a reward for making it through the game

Plan if I had more time My original plan was to have 5 levels each getting progressively harder, however since so much of my time was put into creating the enemy class successfully and making sure that the wizard is the exit for the there was not enough time to implement more than two or maybe three levels. I also wanted the game to have more properties such as the keeping track of the score and such.