• Content count

  • Joined

  • Last visited

About jjwallace

  • Rank
    Advanced Member
  • Birthday

Contact Methods

  • Website URL
  • Twitter
  • Skype

Profile Information

  • Gender
  • Location
    Manhattan NYC

Recent Profile Visitors

668 profile views
  1. Hi guys, I am making an app that overlays a png over a video. I want the user to insert their face via webcam or upload. How do i allow user to upload image to phaser? Is it possible to use webcam? I am also building resize image UI, unless there is already one.
  2. Wow 'broadcast.emit()' sounds really cool
  3. When you create a game object do sprites inside its create class automatically become children of that class? Frome Examples: MonsterBunny = function (game, rotateSpeed) { // We call the Phaser.Sprite passing in the game reference // We're giving it a random X/Y position here, just for the sake of this demo - you could also pass the x/y in the constructor Phaser.Sprite.call(this, game, game.world.randomX, game.world.randomY, 'bunny'); this.anchor.setTo(0.5, 0.5); this.rotateSpeed = rotateSpeed; var randomScale = 0.1 + Math.random(); this.scale.setTo(randomScale, randomScale) game.add.existing(this); }; MonsterBunny.prototype = Object.create(Phaser.Sprite.prototype); MonsterBunny.prototype.constructor = MonsterBunny; MonsterBunny.prototype.update = function() { // Automatically called by World.update this.angle += this.rotateSpeed; }; var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); function preload() { game.load.image('bunny', 'assets/sprites/bunny.png'); } function create() { for (var i = 0.1; i < 2; i += 0.1) { new MonsterBunny(game, i); } }
  4. Hi guys, I have a socket.io server running with node.js and i am trying to add players/sprites to my game. I am trying to figure out the best way to do this. As of now i have been working towards using object arrays but i know this is a better way. socket.on('addPlayer',function(data){ var thisID = data;//myArrayID; if(data.id == myID){ }else{ console.log(thisID); pFish[thisID] = this.add.sprite(); pFish[thisID].x = this.world.centerX; pFish[thisID].y = this.world.centerY; pFish[thisID].anchor.setTo(0.5, 0.5); pMouth[thisID] = this.add.sprite(0, 0, 'spMouth'); pMouth[thisID].anchor.setTo(0.5, 1); pMouth[thisID].animations.add('eat'); pMouth[thisID].animations.play('eat', 30, true); pTail[thisID] = this.add.sprite(0, 0, 'spTail'); pTail[thisID].anchor.setTo(0.5, 0); pTail[thisID].animations.add('swim'); pTail[thisID].animations.play('swim', 30, true); pTail[thisID].y = spMouth.y - 12; pFish[thisID].addChild(spMouth[thisID]); pFish[thisID].addChild(spTail[thisID]); pFish[thisID].scale.setTo(0.2, 0.2); pFish[thisID].angle = 110; } }) So what i really want to do is add a player object. This way i can have all 3 sprites inside the object and i can just change the object. Of course i will need to update each player with the corisponding input comming in from the server. Any good examples of how to do this in a OOP method for Phaser.? Example: BasicGame.Game.prototype = { preload: function () { //this.load.script('io', 'node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js'); //console.log('NODE LOADED'); }, create: function () {
  5. Faktori that game looks sweet
  6. Uncaught ReferenceError: map1 is not defined For the life of me cannot find out why map1 is not found var map; var coins; var layer; var sprite; BasicGame.Game3.prototype = { create: function () { console.log('Game Launched'); this.camera.flash('#006600'); this.loadVars() this.loadLevel(); this.renderGame(); //this.input.onDown.add(this.fire, this); }, fire: function () { }, loadVars: function(){ }, loadLevel: function(){ this.load.tilemap('map1', 'assets/lvl/collision_tests.json', null, Phaser.Tilemap.TILED_JSON); this.load.image('ground_1x1', 'assets/tiles/ground_1x1.png'); this.load.image('walls_1x2', 'assets/tiles/walls_1x2.png'); this.load.image('tiles2', 'assets/tiles/tiles2.png'); // this.load.tileset('ground_1x1', '/assets/tiles/ground_1x1.png', 72, 72); // this.load.tileset('walls_1x2', '/assets/tiles/walls_1x2.png', 72, 72); // this.load.tileset('tiles2', '/assets/tiles/tiles2.png', 72, 72); }, renderGame: function() { console.log(map1); map = this.add.tilemap('map1'); <<<<< ERROR IS HERE!!!!!!!!!!!!!!!!!!!! console.log('Map loaded');
  7. You have to unload the instance of the game. You can encapsulate everything and just destroy it if you want. Sometimes with grunt and angular you will get a double instance of your game also its kinda a pain. Have you tried just destroying the instance of the game and loading another one?
  8. Great call kids! I encapsulated the code and it works well! You saved me, my client would have been very unhappy.
  9. Hi, can you please ad my latest game. Missions 1 and 4 are Phaser menu is Angular. http://www.goarmy.com/joinesd.html
  10. Fade from black when you start state (oncreate) this.camera.flash('#000000'); Fade to black from state: startGame: function (pointer) { this.music.stop(); this.camera.fade('#000000'); this.camera.onFadeComplete.add(this.fadeComplete,this); }, fadeComplete: function () { this.state.start('Game'); } Make sure you have the latest version of phaser.
  11. Ok so i have tried over 9 different methods here. What happends is some how the width and height are original pulled in via portaite mode and then when landscape occurs it still falls back to the original centerX and centerY from orientation change?
  12. Ok this is what i did but i didn't user the resize listener. This makes sense since i think it registers the landscape faster than the actual screen changes. I will move this function to the resize listener.
  13. Uncaught TypeError: Cannot read property 'preUpdate' of undefined Coming from Phaser - phaser.js: 33170 What could it be?
  14. I am trying to prevent my game from starting unless in landscape. I looked at a couple methods but none of them seemed to work. The problem is my game renders all objects and sizes them when it starts. I want to wait for the correct orientation but that takes a second from the variable being set and the actual dimensions changing. Is there a better way to do this? update: function () { if (this.cache.isSoundDecoded('sfxPredator') && this.ready == false){ this.ready = true; console.log('Preload Complete'); } if(IApp.platform == 'tablet-l' || IApp.platform == 'phone-l' || IApp.platform == 'desktop'){ BGame.onLandscape = true; } if(BGame.onLandscape == true && this.ready == true && BGame.onCanStart == true){ console.log('Timer Start'); BGame.onCanStart = false; this.time.events.add(Phaser.Timer.SECOND * 0.3, this.startRenderGame, this); } console.log('Game Started'); this.state.start('Game'); },
  15. What came out of this? How do we destroy a game from Angular?