public void setCameras(Camera camera) { float twoThirds = 2f / 3f; if (VERTICAL_SCREEN) { if (camera == null) { p1Camera.matrix *= Matrix.CreateScale(0.5f); main1Camera.matrix *= Matrix.CreateScale(0.5f); p2Camera.matrix *= Matrix.CreateScale(0.5f); main2Camera.matrix *= Matrix.CreateScale(0.5f); } else { camera.matrix *= Matrix.CreateScale(0.5f); } } else { if (camera == null) { p1Camera.matrix *= Matrix.CreateScale(twoThirds); p1Camera.matrix *= Matrix.CreateTranslation((float)SCREENWIDTH * twoThirds / -2, (float)SCREENHEIGHT * twoThirds / -2, 0) * Matrix.CreateRotationZ(MathHelper.Pi / 2f) * Matrix.CreateTranslation((float)SCREENHEIGHT * twoThirds / 2f, (float)SCREENWIDTH * twoThirds / 2f, 0); main1Camera.matrix = Matrix.CreateScale(twoThirds); main1Camera.matrix *= Matrix.CreateTranslation((float)SCREENWIDTH * twoThirds / -2, (float)SCREENHEIGHT * twoThirds / -2, 0) * Matrix.CreateRotationZ(MathHelper.Pi / 2f) * Matrix.CreateTranslation((float)SCREENHEIGHT * twoThirds / 2f, (float)SCREENWIDTH * twoThirds / 2f, 0); p2Camera.matrix *= Matrix.CreateScale(twoThirds); p2Camera.matrix *= Matrix.CreateRotationZ(MathHelper.Pi / -2f) * Matrix.CreateTranslation(0, (float)SCREENWIDTH * twoThirds, 0); main2Camera.matrix *= Matrix.CreateScale(twoThirds); main2Camera.matrix *= Matrix.CreateRotationZ(MathHelper.Pi / -2f) * Matrix.CreateTranslation(0, (float)SCREENWIDTH * twoThirds, 0); } else if (camera == p1Camera || camera == main1Camera) { camera.matrix *= Matrix.CreateScale(twoThirds); camera.matrix *= Matrix.CreateTranslation((float)SCREENWIDTH * twoThirds / -2, (float)SCREENHEIGHT * twoThirds / -2, 0) * Matrix.CreateRotationZ(MathHelper.Pi / 2f) * Matrix.CreateTranslation((float)SCREENHEIGHT * twoThirds / 2f, (float)SCREENWIDTH * twoThirds / 2f, 0); } else if (camera == p2Camera || camera == main2Camera) { camera.matrix *= Matrix.CreateScale(twoThirds); camera.matrix *= Matrix.CreateRotationZ(MathHelper.Pi / -2f) * Matrix.CreateTranslation(0, (float)SCREENWIDTH * twoThirds, 0); } } }
public DuelScreen(Game1 game, PlayerIndex player) : base(game) { movementVector = Vector2.Zero; accellerationVector = Vector2.Zero; gun = new Gun(player); arm = new Arm(gun); P1Score = new Score(this); bullets = 6; firedBullets = new ArrayList(12); textPopups = new ArrayList(20); this.player = player; this.dead = false; this.droppedGun = false; this.droppedGunTimer = 0f; this.won = false; this.deathTimer = 0f; dropping = false; this.fallForces = new Vector2[8]; Random rand = new Random(); for (int i = 0; i < 8; i++) { fallForces[i] = new Vector2(rand.Next(5), rand.Next(10)); //fallForces[i].X *= rand.Next(2) == 0 ? -1 : 1; fallForces[i].X += 5; } //set up cowboy body parts drawing locations if (player == PlayerIndex.One) { leftArmPos = new Vector2(280, 275); bodyPos = new Vector2(148, 240); headPos = new Vector2(245, 157); leftLegPos = new Vector2(216, 430); rightLegPos = new Vector2(36, 430); holsterPos = new Vector2(140, 418); leftArmText = Game1.IMAGE_LEFTARM; bodyText = Game1.IMAGE_BODY; headText = Game1.IMAGE_HEAD; leftLegText = Game1.IMAGE_LEFTLEG; rightLegText = Game1.IMAGE_RIGHTLEG; holsterText = Game1.IMAGE_HOLSTER; camera = game.p1Camera; } else { leftArmPos = new Vector2(280, 238); bodyPos = new Vector2(45, 192); headPos = new Vector2(245, 157); leftLegPos = new Vector2(30, 440); rightLegPos = new Vector2(206, 428); holsterPos = new Vector2(140, 418); leftArmText = Game1.IMAGE_LEFTARM2; bodyText = Game1.IMAGE_BODY2; headText = Game1.IMAGE_HEAD2; leftLegText = Game1.IMAGE_LEFTLEG2; rightLegText = Game1.IMAGE_RIGHTLEG2; holsterText = Game1.IMAGE_HOLSTER2; camera = game.p2Camera; } }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = SCREENWIDTH; graphics.PreferredBackBufferHeight = SCREENHEIGHT; graphics.IsFullScreen = false; graphics.PreferMultiSampling = false; Content.RootDirectory = "Content"; mode = modes.splash; main1Camera = new Camera(PlayerIndex.One, this); main2Camera = new Camera(PlayerIndex.Two, this); p1Camera = new Camera(PlayerIndex.One, this); p2Camera = new Camera(PlayerIndex.Two, this); main1Camera.matrix = Matrix.Identity; main2Camera.matrix = Matrix.Identity; p1Camera.matrix = Matrix.Identity; p2Camera.matrix = Matrix.Identity; setCameras(null); debugText = false; }