From 98e5b9470fdc102765a289078b3967e3d94fcae0 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Wed, 14 May 2014 12:18:39 +0200 Subject: Added pill to the world and set object anchors to their center re #4 --- game/states/play.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'game/states/play.js') diff --git a/game/states/play.js b/game/states/play.js index c52b498..2d73701 100644 --- a/game/states/play.js +++ b/game/states/play.js @@ -2,6 +2,7 @@ var Wall = require('../prefabs/wall'); var Player = require('../prefabs/player'); +var Pill = require('../prefabs/pill'); function Play() {} @@ -32,7 +33,12 @@ Play.prototype = { }, create: function() { this.createWalls(); + this.createPills(); + this.world.scale = {x:100, y:100}; + this.world.bounds = {x: -50, y:-50, width: this.game.width, height: this.game.height}; + this.world.camera.setBoundsToWorld(); + this.playerA = new Player(this.game, 1, 2, 'player-a', 0); this.game.add.existing(this.playerA); this.addPlayerControls(); @@ -80,6 +86,11 @@ Play.prototype = { this.addToMap(wall.x, wall.y); }, this); }, + createPills: function() { + this.pills = this.game.add.group(); + + this.pills.add(new Pill(this.game, 1,1)); + }, addPlayerControls: function() { var controls = { up: Phaser.Keyboard.UP, -- cgit v1.2.3