예제 #1
0
파일: Sprite.cs 프로젝트: andrewbarry1/8p4c
 public void move(Vector2 amnt)
 {
     position += amnt;
     if (coupledCamera != null && cameraCoupling.X == 1)
     {
         coupledCamera.move(new Vector2(-1 * amnt.X, 0));
     }
     if (coupledCamera != null && cameraCoupling.Y == 1)
     {
         coupledCamera.move(new Vector2(0, -1 * amnt.Y));
     }
 }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }