Giter VIP home page Giter VIP logo

troll-hunter's Introduction

Troll Hunter

troll-hunter's People

Contributors

scmx avatar mrmagnus avatar alex-ross avatar

Stargazers

Mikael Östberg avatar  avatar

Watchers

 avatar Alexander Sverla avatar Mikael Östberg avatar  avatar David Åhlander avatar

troll-hunter's Issues

Game-constructor

Spelet behöver en Game-klass med konstruktor.
Något åt detta hållet tror jag vore bra så småningom.

// js/game.js
function Game() {
  this.player = new Player({ name: 'ZuperAlex' });
  this.level = new Level({ nr: 1 });
}

Game.prototype.start = function () {
  ...
};
// js/app.js
var game;

function restartGame() {
  game = new Game;
  game.start();
}

restartGame();

Laga troll.delay() och spider.delay()

Metoderna gör ingenting just nu. Hur är det tänkt att de ska fungera?

var troll = {
    pos: [0, 0],
    sprite: new Sprite('img/troll.png', [0, 0], [200, 160]),
    hp: 5,
    maxHp: 5,
    delay: 500,
    resetHp: function(){
        this.hp = this.maxHp;
    },
    delay: function(){
        this.delay;
    },
    speed: 100
};

För att undvika förvirring, i min kommande Pull Request kommer jag flytta ut metoden såhär:

Troll.prototype.delay = function () {
  this.delay; //FIXME
};

Fix spider-health

Spiders die on any kind of bullet hit, even though you give them a lot of health.

Level-konstruktor

Spelet behöver en Level-class med konstruktor. Jag tänker mig något liknande följande:

// js/level.js
function Level(opts) {
  this.entities = [];
  this.nr          = opts.nr          || 1;
  this.trollCount  = opts.trollCount  || 1;
  this.spiderCount = opts.spiderCount || 5;
}

Level.prototype.addSpider = function () {
  this.entities.push(new Spider);
};
// js/game.js

function Game() {
  ...
  this.level = new Level({ nr: 1 });
  ...
}

Game.prototype.nextLevel = function () {
  var opts;
  var nextLevelNr = this.level.nr + 1;
  switch (nextLevelNr) {
    case 2:
      opts = { trollCount: 2, spiderCount: 5 };
      break;
    case 3:
      opts = { trollCount: 1, spiderCount: 10 };
      break;
    case 4:
      opts = { trollCount: 3, spiderCount: 5 };
      break;
    default:
      opts = { trollCount: 10, spiderCount: 20 };
      break;
  }
  opts.nr = nextLevelNr;
  this.level = new Level(opts);
};

Objektorientering

Projektet bör ta en mer objektorienterad riktning, ex. bullets borde bli en klass, troll och spindlar borde hantera sin egen död/explosion, player borde vara en klass o.s.v.

Replace trolls and spiders arrays with a new entities array

Om vi samlar alla entities (troll, spindlar, skott, grottor, träd, ...) i en lång array så är det enklare att kolla kollisioner osv.
Tveksamt om vi behöver en class Entity, då alla entities redan har sin egen konstruktor.
Kanske en EntityList? Eller så får Level sköta om den listan. Se #23

Add test suite + TravisCI

Ex:

app/
  player.js
spec/
  player_spec.js

Vi behöver en testsvit.

Och när vi väl har det, så kan vi lägga in TravisCI gratis, så körs testerna automatiskt vid varje push och pull request

Give Tree a HealthBar

Destroying all trees would make it impossible for spiders to spawn, since they always spawn from a random tree.

How about the following?

  • Tree starts burning after being X% damaged
  • Tree becomes a dead tree or disappears when hp is 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.