public GameStateEntryMenu(Game1 g, ContentManager c, NetworkInterface ni) { Game = g; Content = c; ih = new InputHandler(); net = ni; instructions = new Sprite("instructions.png", Content, new Vector2(0, 0), false); float insSclA = (2 * Game1.SCREEN_HEIGHT / 3) / instructions.size.Y; float insMidX = (Game1.SCREEN_WIDTH / 2) - ((instructions.size.X * insSclA) / 2); instructions.move(new Vector2(insMidX, 0)); playersReady = new bool[8]; playerSlides = new float[8]; readyWait = 3000; getReady = new Sprite("ready.png", Content, Vector2.Zero, false); getReady.move(new Vector2( (Game1.SCREEN_WIDTH / 2) - (getReady.size.X / 2), (Game1.SCREEN_HEIGHT / 2) - (getReady.size.Y / 2))); numberSprites = new Sprite[8]; string[] nsNames = new String[8] {"one","two","three","four","five","six","seven","eight"}; Vector2 firstLocation = new Vector2(Game1.SCREEN_WIDTH / 16, 0); for (int x = 0; x < 8; x++) { Vector2 loc = firstLocation + new Vector2((Game1.SCREEN_WIDTH / 8) * x, (Game1.SCREEN_HEIGHT + (instructions.size.Y * insSclA)) / 2); numberSprites[x] = new Sprite(nsNames[x] + ".png", Content, loc, false); numberSprites[x].move(new Vector2(-1 * (numberSprites[x].size.X / 2), 0)); } playerColors = new Color[8]; Random ra = new Random(Environment.TickCount); for (int x = 0; x < 8; x++) { playerColors[x] = new Color(ra.Next(255), ra.Next(255), ra.Next(255)); } whiteTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1); Color[] whiteData = new Color[1] {Color.White}; whiteTexture.SetData(whiteData); playReadySF = true; ready = Content.Load<SoundEffect>("ready"); entry = Content.Load<SoundEffect>("playerjoin"); }
public GameStateResults(ContentManager c, Game1 g, Color[] pc, int[] sc) { Content = c; Game = g; ih = new InputHandler(); whiteTexture = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1); Color[] whiteData = new Color[1] { Color.White }; whiteTexture.SetData(whiteData); playerColors = pc; scores = sc; playerSprites = new Sprite[8]; numberSprites = new Sprite[9]; string[] nsNames = new String[9] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight" }; numberPositions = new Vector2[9]; for (int x = 0; x < 8; x++) { playerSprites[x] = new Sprite("player" + (x+1) + ".png", Content, Vector2.Zero, false); numberSprites[x] = new Sprite(nsNames[x] + ".png", Content, Vector2.Zero, false); Vector2 nsPos = new Vector2(20, ((((Game1.SCREEN_HEIGHT / 8) * x) + ((Game1.SCREEN_HEIGHT / 8) * (x + 1))) / 2) - numberSprites[x].size.Y / 2); numberPositions[x] = nsPos; } results = new Sprite("results.png", Content, Vector2.Zero, false); results.position = new Vector2( (Game1.SCREEN_WIDTH / 2) - (results.size.X / 2), (Game1.SCREEN_HEIGHT / 2) - (results.size.Y / 2)); resultsTimer = 5000; slidePlayer = -1; slideAmounts = new double[8]; endGameTimer = -1; bgColor = 0; increasingBG = true; congrats = Content.Load<SoundEffect>("congrats"); wipe = Content.Load<SoundEffect>("resultslide"); sortPlayers(); }
public GameStateFighting(ContentManager c, Game1 g, Color[] pColors, NetworkInterface ni) { net = ni; shakeAmnt = Vector2.Zero; ra = new Random(Environment.TickCount); Content = c; Game = g; ih = new InputHandler(); camera = new Camera(); camera.setPosition(Vector2.Zero); go = new Sprite("go.png", Content, Vector2.Zero, false); go.move(new Vector2( (Game1.SCREEN_WIDTH / 2) - (go.size.X / 2), (Game1.SCREEN_HEIGHT / 2) - (go.size.Y / 2))); goTimer = 250; winner = new Sprite("game.png", Content, Vector2.Zero, false); winner.move(new Vector2( (Game1.SCREEN_WIDTH / 2) - (winner.size.X / 2), (Game1.SCREEN_HEIGHT / 2) - (winner.size.Y / 2))); winnerTime = 751; platform = new Sprite("platform.png", Content, Vector2.Zero, false); playerOne = new Player("player.png", Content, Vector2.Zero); p1Field = new Sprite("force.png", Content, Vector2.Zero, false); playerOneNumber = 0; playerTwo = new Player("player.png", Content, Vector2.Zero); p2Field = new Sprite("force.png", Content, Vector2.Zero, false); playerTwoNumber = 0; extraFields = new List<Sprite>(); extraFieldTimes = new List<float>(); extraFieldColors = new List<Color>(); playerColors = pColors; scores = new int[8]; matchList = new Vector2[28] { mv(0,7), mv(1,6), mv(2,5), mv(3,4), mv(0,6), mv(5,7), mv(4,1), mv(3,2), mv(0,5), mv(6,4), mv(7,3), mv(1,2), mv(0,4), mv(3,5), mv(2,6), mv(1,7), mv(0,3), mv(4,2), mv(5,1), mv(6,7), mv(0,2), mv(1,3), mv(7,4), mv(6,5), mv(0,1), mv(2,7), mv(3,6), mv(4,5) }; matchList = shuffle(matchList); currentMatch = -1; fieldMultiplier = 1f; suddenDeath = new Sprite("suddendeath.png", Content, Vector2.Zero, false); suddenDeath.position = new Vector2( (Game1.SCREEN_WIDTH / 2) - (suddenDeath.size.X / 2), 50); playedGSE = false; controllerNumbers = new Dictionary<int, int>(); controllerNumbers.Add(0, 1); controllerNumbers.Add(1, 1); controllerNumbers.Add(2, 2); controllerNumbers.Add(3, 2); controllerNumbers.Add(4, 3); controllerNumbers.Add(5, 3); controllerNumbers.Add(6, 4); controllerNumbers.Add(7, 4); camera.move(new Vector2(-350, (Game1.SCREEN_WIDTH / 5))); goSF = Content.Load<SoundEffect>("go"); sdSF = Content.Load<SoundEffect>("suddendeath"); gameSF = Content.Load<SoundEffect>("game"); jumpSF = Content.Load<SoundEffect>("jump"); fieldSF = Content.Load<SoundEffect>("field"); prepareMatch(); }
static void Main() { using (var game = new Game1()) game.Run(); }
public void setOnReady(Game1.fadeDelegate del) { onReady = del; }