musps / mds-frms-reactjs-zelda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MDS ZELDA 42

Install

# Install dependencies
npm install

# Run server (default port : 3000)
npm start

PLAYER COMMANDS

KEY ACTION
ARROW UP Move player upper
ARROW DOWN Move player down
ARROW LEFT Move plauer to the left
ARROW RIGHT Move plauer to the right.
A Attack the first block whsere the plauer direction is set.

Tile

  • Tile configuration are in src/App/Config/Tile.js file.
  • A tile contains
{
  'id': 0, # Unique tile id.
  'name': 'floor', # Tile name.
  'className': 'tile-floor', # Tile css class name.
  'canWalk': true, # Set true or false if the tile is walkable.
  'canBeDestroyed': true, # Set true or false if the tile can be destroyed.

  # Optional if the key 'canBeDestroyed' is set to true.
  # Define the destruction configuration.
  'destroyConfig': {
    'hp': 5 # Amounf of tile hp. eatch player hit will remove one hp.
  }
}

# example
{
  'id': 0,
  'name': 'floor',
  'className': 'tile-floor',
  'canWalk': true,
  'canBeDestroyed': true,
  'destroyConfig': {
    'hp': 5
  }
}

Map

  • Tile configuration are in src/App/Maps/{__FILE__NAME__}.js dir.
  • A Map file contains an array defined at x length and sub array who contains tile id value.
# example
const LevelOne = [
  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0],
  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0],
  [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 2, 2, 0, 0, 0, 0],
  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