this.lasttime_shoot = 0;
this.lasttime_mode = 0;
this.lasttime_damage = 0;
- this.speed = 150;
+ this.speed = SPEED_PLAYER;
this.switchmode(MODE_DETERMINATION);
this.weapon = new JusticeBlaster(game, this);
this.weapon.bulletSpeed = SPEED_PPROJECTILE;
nexttime_determination = Math.random() * WAIT_DETERMINATION;
monsters = game.add.group();
- monsters.add(new Monster(400, 500));
- monsters.children.forEach(function(monster) { monster.enablePhysics(); });
- nexttime_monsterspawn = WAIT_MONSTERSPAWN;
+ nexttime_monsterspawn = WAIT_MONSTERSPAWN / 4;
player = new Player(game.world.width / 2, game.world.height / 2);
player.enablePhysics();
game.camera.follow(player);
cursors = game.input.keyboard.createCursorKeys();
- keyboard_handler = keyPress_default;
-
}
function update () {
var monster = new Monster(Math.random() * game.world.width, Math.random() * game.world.height);
monster.enablePhysics();
monsters.add(monster);
- nexttime_monsterspawn = game.time.now + (WAIT_MONSTERSPAWN / player.love) + (Math.random() * WAIT_MONSTERSPAWN);
+ var waittime = WAIT_MONSTERSPAWN - ((Math.random() * 2000) * player.love);
+ nexttime_monsterspawn = game.time.now + waittime;
+ console.log('Next monster in ' + waittime);
}
if ((game.time.now - player.lastmovetime) > WAIT_KEY) player.body.velocity.x = player.body.velocity.y = 0;
- if (keyboard_handler) keyboard_handler();
-
- }
-
- function keyPress_default() {
-
- // Maybe needed later.
}