Skip to content

Latest commit

 

History

History
126 lines (93 loc) · 5.59 KB

Design.md

File metadata and controls

126 lines (93 loc) · 5.59 KB

Demonstration Game Design

The index.js JavaScript file contains the entire skeleton code which is based upon the original skeleton code provided by Diogo Eichert.

Notice: API links marked with %source% were undocumented at the time of this writing and link to the source code of the implementation on Github. The source may have changed by the time this document is read. Use the links to give a clue where to look in the source.

Game Objective

  • Move the player to the loot position to gain a score point.

Game Objects

The player game object (game.state.player) is a ControllableSprite with a size of 32x32 pixels, colored solid yellow that has collisions enabled.

Videogame API used

Videogame Plugins used

const player = new ControllableSprite()
  // specify the dimensions of the sprite
  .setWidth(32)
  .setHeight(32)
  // specify the color of the sprite
  .setColor(Color.Yellow)
  // specify that the sprite should be added to the collision detection system
  .setSolid()

The loot game object (game.state.loot) is a Sprite with a size of 16x16 pixels, colored solid green that has collisions enabled.

Videogame API used

Videogame Plugins used

  • None
const loot = Videogame.sprite()
  // specify the dimensions of the sprite
  .setWidth(16)
  .setHeight(16)
  // set the starting position in the middle of the scene
  .setCenter(scene.center)
  // specify the color of the sprite
  .setColor(Color.Green)
  // specify that the sprite should be added to the collision detection system
  .setSolid()

The score game object (game.state.score) is a TextSprite with a size of 16x16 pixels, positioned in the top right corner of the scene.

Videogame API used

Videogame Plugins used

  • None
const score = new TextSprite()
  // specify the dimensions of the sprite
  .setWidth(16)
  .setHeight(16)
  // set the position to the top right corner of the scene
  .setRight(scene.right)
  .setTop(scene.top)

The starfield game object (game.state.starfield) is a Starfield sprite that fills the scene with stars that move in parallax.

Videogame API used

Videogame Plugins used

const starfield = new Starfield()
  // specify the sprite motion vector towards the bottom left
  .setSpeedX(-1)
  .setSpeedY(1)

The scene game object (game.state.scene) is the base Scene sprite object which serves as the parent of all other game objects.

Videogame API used

Videogame Plugins used

  • None
const scene = Videogame.scene()
  // specify the color of the sprite
  .setColor(Color.Navy)