public Bullet(ContentManager content, Laser laser) { texture = content.Load<Texture2D>(@"Sprites/laserShot"); Position = laser.position + new Vector2(0, -texture.Height); Rotation = laser.rotation; direction = laser.direction; size = new Rectangle(0, 0, texture.Width, texture.Height); origin = new Vector2(texture.Width / 2, texture.Height / 2); }
public Ship(ContentManager content, GraphicsDeviceManager graphics) { cm = content; //sprite shipRing = content.Load<Texture2D>(@"Sprites/shipRing"); shipTile = content.Load<Texture2D>(@"Sprites/shipTile"); Texture2D consoleTile = content.Load<Texture2D>(@"Sprites/console"); Texture2D laserTile = content.Load<Texture2D>(@"Sprites/laserConsole"); Texture2D teleportTile = content.Load<Texture2D>(@"Sprites/teleportConsole"); healthBar = content.Load<Texture2D>(@"Sprites/healthBar"); position.X = graphics.PreferredBackBufferWidth / 2f; position.Y = graphics.PreferredBackBufferHeight / 2f; //ship kernel using (Stream fileStream = TitleContainer.OpenStream(@"Content\File\kernel.txt")) shipKernel = new ShipKernel(fileStream, shipTile, consoleTile, position); //attribute part1 //attribute part2 speed = 6f; direction = 0; points = 0; //rectangle bound shipRec = new Rectangle(0, 0, shipRing.Width, shipRing.Height); healthRec = new Rectangle(0, 0, healthBar.Width, healthBar.Height); //screen size screenSize.X = graphics.PreferredBackBufferWidth; screenSize.Y = graphics.PreferredBackBufferHeight; controlConsole = new Console(content, this, -114, 66, consoleTile); laserConsole = new Console(content, this, -114, -114, laserTile); teleportConsole = new Console(content, this, 66, -114, teleportTile); shield = new Shield(content, this, 66, 66); turret = new Turret(content, this, 0, -220); laser = new Laser(content, this, 0, -135); alive = true; health = 100; }