# Build Guidelines

Create an HTML Phaser 3 video game. The goal of this game will be to collect "ingredients" and reach the "oven" in order to cook flavored bread. The elements of ingredients and the oven will be introduced at a later time. The game begins on level 1, and will have more levels later so please make a modular framework to support this. Level one will take place on levels-a.json tileset which leverages the platforms.png spritesheet. The player should begin level 1 at coodinates 3, 11 on the tilesheet, and leverages the player.png spritesheet. The game will function as a standard platformer, but with the mechanics outlined below.

## Tools and Organization

- Phaser version 3 HTML game
- Use JavaScript
- Have JavaScript objects reference each other directly via IMPORT and EXPORT using ES6 standards
- Do **NOT** require a web packager.
- Create files and classes in a manner that allows future modifications and scaling at a modular level

## Basic Framework

- 1600 x 900 view
- Scale view to user's viewport.
- Use basic termporary vector graphics that can later be replaced by sprites

## Spritesheet Details

- ./assets/sprites/platforms.png
    - 128px X 128px
        - Red colored sprites:
            - 8, 18, 20, 21
        - Yellow colored sprites:
            - 28, 38, 40, 41
        - Blue colored sprites:
            - 9, 19, 30, 31
        - Green colored sprites:
            - 29, 39, 50, 51
- ./assets/sprites/player.png
    - 128px X 256px
        - Player standing sprite: 0
        - Player walking: animate between 0 and 1 

## Tileset Details

- ./assets/tilesets/levels-a.json

| Tile Property | Value | Description |
| --- | --- | --- |
| floor | true | If player lands on top of this tile, or is on top of the tile, they should not fall through it. The player can jump through a floor but cannot fall through it. |
| solid | true | The player cannot move through this tile from any direction. It should be completely solid and impassable |
| barrier | true | Each {color} barrier has two types of tiles, {solid=true} and {solid=false}. Only one color barrier can be {solid=false} at any time. The solid color is based on the {button=true} {color} that is {pressed=true}. Whenever a {color} {button} becomes pressed all barriers with the same {color} as the {button} become {solid=false} and change to the sprite of the same {color} that is {barrier=true} and {solid=false}. All other barriers change, or remain at, {solid=true} with their corresponding {color} |
| ladder | true | These tiles are ladders, the player should be able to climb up and down these. When climbing up or down the ladder, the player should snap to the center of the ladder. They should also be able to move left or right and fall off the ladder after leaving it's bounds. |
| button | true | Each {color} button has two types of tiles, {pressed=true} and {pressed=false}. Only one button can be pressed at a time. A button is pressed by the player jumping on top of the button. Once the player jumps on the button it becomes {pressed=true} and switches it's tile to the correct tile in the tileset. All other buttons become {pressed=false} and change their tile to the corresponding tile for their {color}. Then all barrier rules are applied. |
| color | { red \| yellow \| blue \| green } | There are four colored {buttons} and {barriers} that are possible to exist on a level. All {buttons} and {barriers} are connected to each other by {color} |

## Gameplay

- Things I will add later.
    - Enemies
    - ingredients
    - oven
    - keys and locks
    - background images for levels
    - background music
    - sound effects

## Controls

- Left and right arrow keys to walk
- Up and Down when over a ladder to climb up and down
- Up when not on a ladder, or when on a {top=true} ladder, to jump

## Mechanics

\- The player should have three total lives to start with. Later in game design we'll add ways to get more lives.
