// constructor public Missile(Texture2D texture, PlayerShip player_ship, float playerMouse_angle) { missile_texture = texture; missile_x = player_ship.player_x + 15; // this is the player's position, centre of sprite missile_y = player_ship.player_y - 91; //missile has initial speed of magnitude 5, and fires in the mouse direction missile_vel_x = player_ship.vel_x + missile_mag_vel * (float)System.Math.Cos(playerMouse_angle); missile_vel_y = player_ship.vel_y + missile_mag_vel * (float)System.Math.Sin(playerMouse_angle); missile_angle = playerMouse_angle; //set the remaining bounces bounces_remaining = player_ship.missile_bounce_limit; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here background = Content.Load <Texture2D>("background"); mouseSprite = Content.Load <Texture2D>("mouseSprite"); // create and load the player's ship with initial position x=400, y=240 player_ship = new PlayerShip(Content.Load <Texture2D>("player_ship2"), 400, 240); // create and load our asteroid[s] //asteroid = new Asteroid(Content.Load<Texture2D>("asteroid_sprite1")); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here background = Content.Load<Texture2D>("background"); mouseSprite = Content.Load<Texture2D>("mouseSprite"); // create and load the player's ship with initial position x=400, y=240 player_ship = new PlayerShip(Content.Load<Texture2D>("player_ship2"), 400, 240); // create and load our asteroid[s] //asteroid = new Asteroid(Content.Load<Texture2D>("asteroid_sprite1")); }