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
- New technologies (webpark and babel)
- Damage of Entities
- Reproduce the background
Thank you for attention!
War Space
By supersmf
War Space
- 472