Jump to content

Phaser Weapon.fire only going up Y axis


DanielPhaser
 Share

Recommended Posts

I am making a platformer game which I have implemented a weapon fire method to shoot some projectiles. I find that I am unable to fire these projectiles along the X axis rather than the Y. 

 

Here is a that section of the code within the create function:

	weapon = this.game.add.weapon(1, 'bullet');
	weapon.bulletKillType = Phaser.Weapon.KILL_WORLD_BOUNDS;

and the code within create for the bullet:

if(this.cursors.down.isDown){
    	weapon.bulletAngleOffset = 90; 
    	weapon.bulletSpeed = 300;
    	weapon.x = this.fNobleRanger.x;
    	weapon.y = this.fNobleRanger.y;
    	weapon.fire();
    	
    }

The projectile is firing from my desired sprite, however the projectile shoots up and then falls back down. I want to shoot the projectile along the X axis instead.

Any tips?

I am silly. Found out about fireAngle, but to further this question: is it possible to have this item not be affected by game physic gravity?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...