DEV Community

Cover image for Dev Log #15 - Collisions
Devtonian
Devtonian

Posted on

Dev Log #15 - Collisions

Today I kept working on my gamified portfolio site with Phaser.js.

Progress

  • I've started creating Scenes for the buildings' interiors. One challenge that immediately became apparent was how to make the player aware that they were close to the exit and could action it to leave the building. I've opted for creating an invisible rectangle and using tweens to animate the player's sprite color as a signal. It's neat and I can reuse the code for all buildings.
  • Whereas previously I was using one unique tile for the Game scene's terrain, I've now randomised to create a more organic-looking landscape. As I'm using Math.random(), at each run the game will generate a different landscape.
  • I've added the first NPC, although I'm struggling to make collisions work properly. I'm sure I will figure it out with enough time. Previously, when a player exited a building, they would be spawned in the same initial location. I've updated this so that they're now spawned in front of the building they're exiting.
  • Code is quite messy at the moment, but I'm still trying to keep it as clean as possible. Refactoring will come later.
  • Phaser's docs really need a do-over.

Life

  • Leg day and some walking.
  • Way too much coffee.

Other work

  • CompTIA Project+ Anki flashcards. Preparing for this exam has taken much longer than I thought it would.

Top comments (0)