Jul 31, 2012 at 12:46 AM
Edited Jul 31, 2012 at 12:47 AM
Could someone please help for the life of me, I can't get my bullet sprites to fire from the tip of my spacecraft. I've got the bullets firing from center of spaceship, but I can't figure out how to make it instead fire from the tip of the spacecraft.
I have checked my collision filtering so Bullets and SpaceCraft are not colliding.
Code for my Create Bullet: The commented line of code should have placed the bullet launch at top center of my space craft...
bullets = new SpriteBullet(bulletTexture, BodyType.Dynamic, world, ObjectType.BULLET, this.screenSize);
//bullets.Body.Position = player.Body.Position + ConvertUnits.ToSimUnits(new Vector2(player.Texture.Width, player.Texture.Height / 2f));
bullets.Body.Position = player.Body.WorldCenter;
bullets.Body.Rotation = player.Body.Rotation;
Inside my Bullet class, this is the code for bullet's Update:
this.Body.ApplyLinearImpulse(this.Direction * (speedMove * (float)gameTime.ElapsedGameTime.TotalSeconds));