public Shield(string assetName, SpaceShip ship, Vector2 velocity, float springConstant) : base(assetName, ship.Position + new Vector2(30, 30), velocity, 15f, Vector2.Zero, Vector2.Zero, 1) { //Step 4.3: Set the ship parameter as the target of this shield target = ship.Position; this.springConstant = springConstant; }
public PlayingState() { //Step 1.1: Create a PhysicsObject, place it in the middle of the screen and add it to the PlayingState. //Use one of the ball sprites and scale = 30 ball = new PhysicsObject("GreenBallX", new Vector2(Movement.Screen.X / 2, Movement.Screen.Y / 2), new Vector2(0, 0), 30, new Vector2(0, 0), Vector2.Zero, 1); this.Add(ball); //Step 2.1: Create a SpaceShip, place it in the middle of the screen and add it to the PlayingState. //Use the spaceship sprite. spaceship = new SpaceShip("spr_spaceship", new Vector2(Movement.Screen.X / 2, Movement.Screen.Y / 2), ball, 600f, 3f); this.Add(spaceship); //Step 4.1: Create a Shield without starting velocity, place it in the middle of the screen and add it to the PlayingState. //Use one of the ball sprites. shield = new Shield("spr_ball_green", spaceship, new Vector2(0, 0), 0.2f); this.Add(shield); }
public PlayingState() { // The target for the spaceship to go after. _target = new PhysicsObject("spr_ball_green", GameEnvironment.Screen.ToVector2() / 2, Vector2.Zero, 30, Vector2.Zero) { Visible = false }; // The spaceship SpaceShip spaceShip = new SpaceShip("spr_spaceship", GameEnvironment.Screen.ToVector2() / 2, _target); // The shield Shield shield = new Shield("GreenSoftColorBall", spaceShip, Vector2.Zero); Add(shield); Add(_target); Add(spaceShip); }
public Shield(string assetName, SpaceShip ship, Vector2 velocity) : base(assetName, ship.Position + new Vector2(30, 30), velocity, 15f, Vector2.Zero) { targetObject = ship; }