Jump to content


  • Content Count

  • Joined

  • Last visited

  1. I recommend use trackSprite for rotation of weapon's bullet, for example: weapon = game.add.weapon(10, 'bullet'); weapon.trackSprite(player, 0, 0, true); It's seems the easiest way to solve the problem.
  2. Hello. I am using phaser weapon plugin and want fire in forEach loop: var weapon = game.add.weapon(10, 'bullet'); enemies.forEachAlive(function(enemy){ if(enemy.name == 'p1'){ player.rotation = game.physics.arcade.angleBetween(player, ednemy); weapon.fireAtSprite(enemy); } }); If I have 5 enemies in a row, and only 3 if them have name = p1, after executing this code, player sprite is rotate to the last enemy, but there is only one bullet. What can I do here?
  3. Found solution via getFirstDead() Any other suggestions?
  4. Hello. I am using weapon.fire() function and I want to set special property for bullet, that apear after calling this function. I tried to use forEach: weapon.bullets.forEach(function(bullet){ if(bullet.target == undefined){ bullet.taget = 'prop1'; return; } }); weapon.fire(); but this does not work.
  5. Hello. I am trying to use Weapon class, and I found some problem. Here is my code: var game = new Phaser.Game(640, 360, Phaser.AUTO); var GameState = { preload: function(){ game.load.image('player', 'assets/images/player.png'); game.load.image('enemyBody', 'assets/images/enemyBody.png'); game.load.image('bullet', 'assets/images/bullet.png'); }, create: function(){ this.player = game.add.sprite(game.world.centerX, game.world.centerY, 'player'); this.enemy = game.add.sprite(500, 200, 'enemyBody'); //this.makeShoot(); this.enterKey = this.game.input.keyboar
  • Create New...