Loading

War Space

supersmf

This is a live streamed presentation. You will automatically follow the presenter and see the slide they're currently on.

Gaidykevich Oleg

How does it look like

Code structure

OOP style

export default class Entity{
    constructor(pos, sprite, speed, dir) {
        this.pos = pos;
        this.sprite = sprite;
        this.speed = speed || 0;
        this.dir = dir || null;
    }
}
import Entity from './Entity';

export default class Character extends Entity {
    constructor(pos, sprite, speed, dir, life) {
        super(pos, sprite, speed, dir);
        this.life = life || 1;
        this.lastFire = Date.now();
        this.border = false;
        this.bullets = [];
        this.visible = true;
    }

    autopilot(dt, WIDTH, HEIGHT) { ... }

    handleInput(dt) { ... }

    checkBounds(WIDTH, HEIGHT) { ... }

    update_bullets(WIDTH, HEIGHT, dt, bulletSpeed, player) { ... }

    damage() { ... }

JS files

Entity.js - class for all the entities of the game

Character.js - an extension of the Entity class for game characters

Sound.js - work with sound

Sprite.js - work with animation

input.js - processes incoming information

main.js - controls the main cycle, the state and processing of game data

resources.js - responsible for uploading data

utils.js - additional functions

Main Problems

  1. New technologies (webpark and babel)
  2. Damage of Entities
  3. Reproduce the background

Thank you for attention!

Made with Slides.com