• Content Count

  • Joined

  • Last visited

  1. I should add game is passing the game object i create with, so its not overwriting the game object used for game.add.sprite
  2. Does this behavior sound familiar to anyone? Working on a multiplayer client. I have a player prototype that is created when the client is told that a new player has joined the server: Player = function (id, game, player) { this.x = 300; this.y = 300; = id; this.dir = "-1"; = game; this.player = player; this.sprite = game.add.sprite(300, 300, 'ms',1); this.sprite.anchor.set(0.5); this.sprite.animations.add('right', [6,7,8],4,true); this.sprite.animations.add('left', [3,4,5],4,true); this.sprite.animations.add('down', [0,1,2],4,true); this.sprite.animations.add('up', [9,10,11],4,true); game.physics.enable(this.sprite, Phaser.Physics.ARCADE); this.sprite.body.setSize(72, 32,28,96); this.nametext = game.add.text(236, 364, this.player, { font: '14px Arial', fill: '#ffffff' }); this.nametext.anchor.set(0.5); }; That player creation is stored in an array... Then whenever I receive an update i pool through the array and update accordingly: // Update User Info socket.on('userupdate',function(data) { info = data.split(','); if(info[0]!=myid){ info = data.split(','); for(a=0; a<totalplayers; a++){ if(playerArray[a].player == info[0]){ playerArray[a].sprite.x = info[1]; playerArray[a].sprite.y = info[2]; playerArray[a].dir = info[3]; } } } }); I've checked that the data comes in is proper. Here is the REALLY weird thing. When im clicked on the screen the sprite does not show up at all. When i click OFF the browser and lose focus, the sprite appears and updates correctly... I`m sure I am making a dumb mistake??
  3. So I have some cut scenes in my game that have simple audio and events tied to the timer to display animations on the screen. The problem is when i click off the browser, the animation time stops, but the sound loop while it stops 'playing' keeps progressing. So basically start cut scene timers in sinc. At 5 seconds i click onto another window. wait 5 seconds and click back on the game, sound will be at 10 seconds, but the animation at 5. Anyway to make sure these sync up whether people click off the window or not?
  4. Ok so I figured most of this out, the emitter you create functions as a group and you can access it via setAll and callAll, only problem is I cant seem to add it to any other groups to maintain my collision detection, when I add the emitter group or do a for each on it and try to add the individual pieces no collision detection takes place...
  5. Working on an asteroids spoof. I have an asteroid that upon being clicked explodes. I use the particle emitter to break it into a bunch of small rocks which fly everwhere, love it, works great, love the physics of it. My question is, how would i approach retaining these particles. I would like to have a big asteroid that upon getting shot would use the emitter to break in the small ones, but I would ideally like these small ones stored in a group and then able to be shot as well, where as with the initial setup i have the particles once created disappear after the time stamp has run its course. Best way to approach this? Thanks Rob
  6. Thanks! Whats the difference between enable and enableBody?
  7. Hi I am new to phaser, having trouble manipulating objects that are in a group:; = 60; this.allAsteroids =; this.asteroid = this.allAsteroids.create(DoomSpinner.convertWidth(400), DoomSpinner.convertHeight(50),'white1');; val = Math.random()*30-15; this.asteroid.velocity.x=val; this.asteroid.body.angularAcceleration = val;I get a cannot set property 'x' of undefined error. I plan on having lots of asteroids, so how can I give them velocity and still use them in a group? Thanks for answering the noob question.