Search the Community
Showing results for tags 'help phaser'.
-
Hello, Today, i have problem... I would like when i "myweapon.fire();" my bullet follow the good direction according to the position of my character. Problem in movie: https://i.gyazo.com/d5d4828c9dbdeac86dd0df08fb0f59e8.mp4 My weapon source code: (in create) characterlaser = game.add.weapon(3, 'laser'); characterlaser.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS; characterlaser.bulletSpeed = 400; characterlaser.fireRate = 60; characterlaser.trackSprite(character, 0, 0, true); When i fire: (in update) if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { character.x -= 2; character.play('marcheagauche'); } else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { character.x += 2; character.play('marcheadroite'); } else if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) { character.y -= 2; character.play('marcheenhaut'); } else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { character.y += 2; character.play('marcheenbas'); } else if(game.input.keyboard.isDown(32)) { characterlaser.fire(); } Thank you very much in all those who will come to help me !