Defender 2095 - JavaScript game in development

Sunday 23rd July 2023



Player's ship changing direction

I have a few issues with the way the player's ship changes direction.
In the original Defender the ship simply switched to face in the opposite direction and the ground and player ship shifted accordingly until the ship was in the exact opposite x co-ordinate.
The way I have it at the moment isn't quite right and the ship 'swings' far too much. Needs some closer attention as currently it's fairly maddening to 'swing' and reverse into an alien that you had no idea was there.
Update: resolved the player ship shifting issue and added a small shift for aesthetics. Finally feel that controlling the ship is fun.

Dev log - Development started January 2023

  • Implemented the (bastard) saucer
  • Added the scanner with some rudimentary percentage calculations
  • Need to attach human to player ship when caught while falling
    • Create x index beneath ship to allow more than one human to be collected
    • Create 'rescued' flag for the human item when collected by the player's ship
  • Need to destroy humans if they fall from a great height (ground - 300px)
  • Issue with aliens clinging to player when in mutant mode - this also stops the drawing of stars and cancels effective movement of other sprites!
  • Issue with humans not being properly released in some situations
  • Aliens becoming mutants if they successfully pull a human to the top of the screen (need to create Mutant graphic)
  • Aliens now taking humans and dropping them when destroyed
  • Removed explosions and now use spawnSparks() on alien and player death.
  • playerAlienCollision() now triggering playerDeath()
  • Abandoned the DropZone graphics. Implemented a classic Defender look and feel with the 'vector' landscape and green aliens.
  • Implemented the classic Defender death cycle - flashing white screen then explosion.
  • Playship now drifts back to origin X when not thrusting.
  • Ripped some original Defender sound effects.
  • Enhanced player ship movement based on velocity (g.groundspeed).
  • Improved ship 'swing' when changing directions.
  • Increased alien Y threshold to allow them to reach the floor and interact with humans.
  • Abandoned the concept of 'thrust' and opted for a constantly moving terrain. The original Defender was a spaghetti-fingered affair and I wanted to avoid that.
  • Implemented a Dropzone (from Atari 800XL) feel to the background graphics. Drew the art in Photoshop at half scale (480 x 98) and exported for web at 200% scale using nearest neighbour to present the pixelated look.
  • Fixed backdrop 'tearing' when it reaches the screen bounds and gets re-drawn at the other side.
    • Simply re-drawing the backdrop at object.width * -1 for backdrops travelling left to right, or at object.width (essentially the canvas width) for backdrops travelling right to left, wasn't good enough. I needed to calculate precisely how far below zero or beyond canvas width the object had been drawn and then add or subtract that difference to / form the new x co-ordinate). Otherwise the graphics would develop gaps and appear to 'tear'. The reason for this precision is that as x is adjusted on movement I take into consideration the DELTA time and multiply the x,y values by that.
  • Ripped the codebase for Space Invaders 2095 and created a horizontal scrolling backdrop.
  • Figuring out how to create the authentic Defender lasers.