+ walls = game.add.group();
+ walls.classType = Phaser.TileSprite;
+ walls.enableBody = true;
+
+ walls.add(game.add.tileSprite(WALL_BORDER, WALL_BORDER, game.world.width - (WALL_BORDER * 2), WALL_THICKNESS, 'wall'));
+ walls.add(game.add.tileSprite(WALL_BORDER, game.world.height - WALL_THICKNESS - WALL_BORDERBOTTOM, game.world.width - (WALL_BORDER * 2), WALL_THICKNESS, 'wall'));
+ walls.add(game.add.tileSprite(WALL_BORDER, WALL_BORDER, WALL_THICKNESS, game.world.height - WALL_BORDER - WALL_BORDERBOTTOM, 'wall'));
+ walls.add(game.add.tileSprite(game.world.width - WALL_THICKNESS - WALL_BORDER, WALL_BORDER, WALL_THICKNESS, game.world.height - WALL_BORDER - WALL_BORDERBOTTOM, 'wall'));
+ walls.children.forEach(function(wall) { wall.body.immovable = true; });
+
+ determinations = game.add.group();
+ nexttime_determination = Math.random() * WAIT_DETERMINATION;
+
+ monsters = game.add.group();
+ nexttime_monsterspawn = WAIT_MONSTERSPAWN / 4;
+
+ player = new Player(game.world.width / 2, game.world.height / 2);
+ player.enablePhysics();
+ game.add.existing(player);
+ game.camera.follow(player);
+ cursors = game.input.keyboard.createCursorKeys();
+
+ }
+
+ update() {
+
+ game.physics.arcade.collide(player, walls);
+ game.physics.arcade.overlap(player, determinations, function(p,d) { p.overlap_determination(d); });
+ game.physics.arcade.overlap(player, monsters, function(p,m) { m.overlap_player(p); });
+
+ if (game.time.now > nexttime_determination)
+ {
+ var determination = new Determination((Math.random() * (game.world.width - ((WALL_THICKNESS + WALL_BORDER) * 4))) + ((WALL_THICKNESS + WALL_BORDER) * 2), (Math.random() * (game.world.height - ((WALL_THICKNESS + WALL_BORDER) * 4) - WALL_BORDERBOTTOM)) + ((WALL_THICKNESS + WALL_BORDER) * 2));
+ determination.enablePhysics();
+ determinations.add(determination);
+ nexttime_determination = game.time.now + (WAIT_DETERMINATION / 2) + (Math.random() * WAIT_DETERMINATION);
+ }