Example #1
0
        public GameManager(Game game, int level)
        {
            mGame = game;

            mPlayer1 = new Character(game, new Pointf(400, 200), new Size(32, 32), new Velocity(), PlayerIndex.One);
            mPlayer2 = new Character(game, new Pointf(350, 200), new Size(32, 32), new Velocity(), PlayerIndex.Two);
            mBoss = null;
            mLevel = level;
            switch (level)
            {
                case 1:
                    mMap = MapBuilder.BuildLevel1(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - New Mission");
                    break;
                case 2:
                    mMap = MapBuilder.BuildSolo(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                    mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(MapHelper.GetLastColumn()-1.5f, 1));
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Plus vs Minus");
                    break;
                case 3:
                    mMap = MapBuilder.BuildBossLevel(mGame, new Size(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), ref mPlayer1);
                    mBoss = new Character(game, new Pointf(350, MapHelper.GetPlatformYAtLevel(1.5f)), new Size(64, 64), new Velocity(), PlayerIndex.Three);
                    mBackgroundSong = mGame.Content.Load<Song>("music/Electrolyte - Volt");
                    break;
            }

            mHud = new Hud(new Pointf(0, game.Window.ClientBounds.Height - Hud.HUD_HEIGHT), mGame, level);

            mIsPlayingSound = false;
            mGangnamSound = game.Content.Load<SoundEffect>("newgangnam");
            mGangnamInstance = mGangnamSound.CreateInstance();
        }
Example #2
0
        public static MapModel BuildBossLevel(Game game, Size mapSize, ref Character aChar)
        {
            MapModel map = new MapModel(game, mapSize, Score.GenerateDefaultScore(), "bg");
            MapHelper.SetPlayerInfo(aChar.JumpHeight, aChar.mSize);
            MapHelper.SetMap(ref map);

            MapHelper.BuildMapBorders();

            ExitDoorModel door1 = MapHelper.BuildExitDoor(0, 8, PlayerIndex.One);
            ExitDoorModel door2 = MapHelper.BuildExitDoor(MapHelper.GetLastColumn() - 3, 8, PlayerIndex.Two);

            map.AssignExitDoors(ref door1, ref door2);

            return map;
        }
Example #3
0
        public void Update(GameTime gameTime)
        {
            // pause state
            if (Keyboard.GetState().IsKeyDown(Keys.P) || (GamePad.GetState(PlayerIndex.One).IsConnected && GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Back)))
            {
                StateManager.GetInstance().SetState(StateManager.GameState.PAUSE);
                return;
            }

            if (!mIsPlayingMusic && !mIsPlayingSound)
            {
                mIsPlayingMusic = true;
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Play(mBackgroundSong);
            }

            CheckCollision();

            mPlayer1.Update(gameTime);
            mPlayer2.Update(gameTime);

            if (mBoss != null) mBoss.Update(gameTime);
            mMap.Update(gameTime);

            if (mBoss != null)
            {
                mBossCntr += gameTime.ElapsedGameTime.Milliseconds;
                if (mBossCntr >= 600)
                {
                    //mBoss.RequestJump();
                    mBossCntr = 0;
                }
            }

            if (mP1Time == -1 && mMap.IsPlayerDone(PlayerIndex.One))
            {
                mP1Time = mHud.CurrentTime;
            }
            if (mP2Time == -1 && mMap.IsPlayerDone(PlayerIndex.Two))
            {
                mP2Time = mHud.CurrentTime;
            }

            if (IsDone())
            {
                mIsWinner = true;
                Console.WriteLine(mMap.GetAlphaScore(mHud.CurrentTime).ToString());

                if (!mIsPlayingSound)
                {
                    mIsPlayingSound = true;
                    mIsPlayingMusic = false;
                    MediaPlayer.IsRepeating = false;
                    MediaPlayer.Stop();
                    mGangnamInstance.Play();
                    mHud.GameWin(mLevel, PlayerIndex.Four);

                    mTimeFinishedAt = mHud.CurrentTime;
                }

            }
            if (mIsWinner)
            {
                mSongCntr += gameTime.ElapsedGameTime.Milliseconds;
                mWinAnimationCntr += gameTime.ElapsedGameTime.Milliseconds;
                if (mWinAnimationCntr >= mAnimCntrCurrentInterval && !mPlayer1.JumpRequest &&
                    (mSongCntr < 56300 || mSongCntr > 59600))
                {
                    if (mWinAnimationLeft)
                    {
                        mPlayer1.MoveLeft();
                        mPlayer2.MoveRight();
                    }
                    else
                    {
                        mPlayer1.MoveRight();
                        mPlayer2.MoveLeft();
                    }
                    mPlayer1.RequestJump();
                    mPlayer2.RequestJump();
                    mWinAnimationCntr = 0;
                    mWinAnimationLeft = !mWinAnimationLeft;

                    if (mAnimCntrCurrentInterval > ANIM_INTERVAL_MIN)
                    {
                        mAnimCntrCurrentInterval -= 15;
                    }
                }
                else if (mSongCntr >= 5000 && mLevel != 3)
                {
                    if (mLevel == 1)
                    {
                        TimeSpan time = TimeSpan.FromMilliseconds(mTimeFinishedAt);
                        StateManager.GetInstance().ShowResults(mPlayer1.Score, mPlayer2.Score, mMap.GetAlphaScore(mTimeFinishedAt), time.Minutes.ToString("D2") + ":" + time.Seconds.ToString("D2"));
                    }
                    else
                    {
                        TimeSpan time1 = TimeSpan.FromMilliseconds(mP1Time);
                        TimeSpan time2 = TimeSpan.FromMilliseconds(mP2Time);
                        StateManager.GetInstance().ShowResults(mPlayer1.Score, mPlayer2.Score, time1.Minutes.ToString("D2") + ":" + time1.Seconds.ToString("D2"), time2.Minutes.ToString("D2") + ":" + time2.Seconds.ToString("D2"),
                                                                mMap.GetAlphaScore(mP1Time), mMap.GetAlphaScore(mP2Time));
                    }
                }
            }

            mHud.UpdatePlayerScore(mPlayer1.Score, mPlayer2.Score);
            mHud.Update(gameTime);

            CheckCollision();

            if (!ProjectHelper.IsDebugNoKill)
            {
                if (mPlayer1.IsDestroyed)
                {
                    deadAnimationTimer += gameTime.ElapsedGameTime.Milliseconds;
                    mPlayer1.SetDeadState();
                    if (deadAnimationTimer > deadAnimationTimeLimit)
                    {
                        Console.WriteLine("Player1 died");
                        if (mLevel == 2)
                        {
                            mPlayer1 = new Character(mGame, new Pointf(400, 200), new Size(32, 32), new Velocity(), PlayerIndex.One);
                            mPlayer1.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(0.5f, 1));
                            mPlayer1.SetIdleState();
                        }
                        else
                        {
                            StateManager.GetInstance().SetState(StateManager.GameState.DEAD_SCREEN);
                            mPlayer1.SetIdleState();
                        }
                        deadAnimationTimer = 0f;
                    }
                }
                else if (mPlayer2.IsDestroyed)
                {
                    deadAnimationTimer += gameTime.ElapsedGameTime.Milliseconds;
                    mPlayer2.SetDeadState();
                    if (deadAnimationTimer > deadAnimationTimeLimit)
                    {
                        Console.WriteLine("Player 2 died");
                        if (mLevel == 2)
                        {
                            mPlayer2 = new Character(mGame, new Pointf(350, 200), new Size(32, 32), new Velocity(), PlayerIndex.Two);
                            mPlayer2.mPosition = new Pointf(MapHelper.GetPointForColumnAndLevel(MapHelper.GetLastColumn() - 1.5f, 1));
                            mPlayer2.SetIdleState();
                        }
                        else
                        {
                            StateManager.GetInstance().SetState(StateManager.GameState.DEAD_SCREEN);
                            mPlayer2.SetIdleState();
                        }
                        deadAnimationTimer = 0f;
                    }
                }
                else if (mBoss != null && mBoss.IsDestroyed)
                {
                    Console.WriteLine("Boss died");
                }
            }
            GamePadState pad1 = GamePad.GetState(PlayerIndex.One);
            GamePadState pad2 = GamePad.GetState(PlayerIndex.Two);
            if (Keyboard.GetState().IsKeyDown(Keys.R) ||
                (pad1.IsConnected && pad1.IsButtonDown(Buttons.Start) &&
                pad2.IsConnected && pad2.IsButtonDown(Buttons.Start)))
            {
                StateManager.GetInstance().ResetState(StateManager.GameState.PLAY);
            }
        }
Example #4
0
        public void HandleCollision(List<Model.Collision> collisions, ref Character chara)
        {
            chara.mCollisionStatus = Displayable.CollisionStatus.NONE;

            chara.EnableFreeFall();
            foreach (Model.Collision collision in collisions)
            {
                if (!collision.BlocksMovement) continue;
                switch (collision.Status)
                {
                    case Displayable.CollisionStatus.BOTTOM:
                        chara.DisableFreeFall();
                        if (!chara.JumpRequest)
                        {
                            chara.mMovementState = Character.State.Idle;
                            chara.mCurrentJumpState = Character.State.Idle;
                        }
                        break;
                    case Displayable.CollisionStatus.LEFT:
                        chara.mCollisionStatus = Displayable.CollisionStatus.LEFT;
                        chara.mMovementState = Character.State.Idle;
                        break;
                    case Displayable.CollisionStatus.RIGHT:
                        chara.mCollisionStatus = Displayable.CollisionStatus.RIGHT;
                        chara.mMovementState = Character.State.Idle;
                        break;
                    case Displayable.CollisionStatus.TOP:
                        if (chara.mCurrentJumpState == Character.State.Jumping)
                        {
                            chara.mCurrentJumpState = Character.State.Falling;
                        }
                        chara.EnableFreeFall();
                        break;
                    case Displayable.CollisionStatus.NONE:
                        chara.EnableFreeFall();
                        break;
                }
            }
        }
Example #5
0
        public static MapModel BuildLevel1(Game game, Size mapSize, ref Character aChar)
        {
            MapModel map = new MapModel(game, mapSize, Score.GenerateDefaultScore(), "bg");
            MapHelper.SetPlayerInfo(aChar.JumpHeight, aChar.mSize);
            MapHelper.SetMap(ref map);

            MapHelper.BuildMapBorders();

            MapHelper.BuildResistor(3, 1, Resistor.Type.PLAYER_TWO);
            MapHelper.BuildResistor(2, 1, Resistor.Type.PLAYER_TWO);

            MapHelper.BuildPlatform(2, 1, 2, Wall.Colors.BLUE);

            MapHelper.BuildCollectable(1.9f, 1.8f, 1);
            MapHelper.BuildCollectable(3f, 1.8f, 1);
            MapHelper.BuildResistor(3, 2, Resistor.Type.PLAYER_ONE);
            MapHelper.BuildResistor(2, 2, Resistor.Type.PLAYER_ONE);

            // 2nd platform level 1
            MapHelper.BuildPlatform(7, 1, 2, Wall.Colors.RED);
            MapHelper.BuildResistor(7, 1, Resistor.Type.PLAYER_ONE);
            MapHelper.BuildResistor(8, 1, Resistor.Type.PLAYER_ONE);

            MapHelper.BuildCollectable(6.9f, 1.8f, 1);
            MapHelper.BuildCollectable(8f, 1.8f, 1);
            MapHelper.BuildResistor(7, 2, Resistor.Type.PLAYER_TWO);
            MapHelper.BuildResistor(8, 2, Resistor.Type.PLAYER_TWO);

            MapHelper.BuildWall(MapHelper.GetLastColumn() - 2,
                                1,
                                new Size(map.mSize.Width - MapHelper.GetColumnXAt(MapHelper.GetLastColumn() - 2) - MapHelper.GetOffset(),
                                         map.mSize.Height - MapHelper.GetPlatformYAtLevel(1) - MapHelper.GetOffset()),
                                Wall.Colors.WHITE);

            MapHelper.BuildPlatform(0, 2, MapHelper.GetLastColumn()-2, Wall.Colors.BLUE);

            MapHelper.BuildMoveableBox(MapHelper.GetLastColumn() - 4, 3f, new Size(40, 20));
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 6, 3, 1);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 7, 3, 1);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 6, 3.1f, Resistor.Type.PLAYER_TWO);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 7, 3.1f, Resistor.Type.PLAYER_TWO);

            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 10, 3, 1);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 11, 3, 1);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 10, 3.1f, Resistor.Type.PLAYER_ONE);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 11, 3.1f, Resistor.Type.PLAYER_ONE);

            ElevatorModel elev1 = MapHelper.BuildElevator(0, 4);
            SwitchModel switch1 = MapHelper.BuildSwitch(3, 2.2f);
            MapHelper.RegisterSwitchToElevator(ref switch1, ref elev1);

            MapHelper.BuildPlatform(1, 4, MapHelper.GetLastColumn() - 2, Wall.Colors.BLUE);
            MapHelper.BuildPlatform(2, 5, 2, Wall.Colors.BLUE);

            SwitchModel switch12 = MapHelper.BuildSwitch(5, 4.05f);
            MapHelper.RegisterSwitchToElevator(ref switch12, ref elev1);

            MapHelper.BuildResistor(2, 5, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(3, 5, Resistor.Type.NEUTRAL);

            MapHelper.BuildCollectable(7, 5, 1);
            MapHelper.BuildCollectable(8, 5, 1);

            MapHelper.BuildPlatform(11, 5, 2, Wall.Colors.BLUE);

            MapHelper.BuildResistor(11, 5, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(12, 5, Resistor.Type.NEUTRAL);

            MapHelper.BuildWall(MapHelper.GetLastColumn() - 2.5f,
                                4.5f,
                                new Size(map.mSize.Width - MapHelper.GetColumnXAt(MapHelper.GetLastColumn() - 2.5f) - MapHelper.GetOffset(),
                                         map.mSize.Height - MapHelper.GetPlatformYAtLevel(0.5f) - MapHelper.GetOffset()),
                                Wall.Colors.WHITE);

            MapHelper.BuildWall(MapHelper.GetLastColumn() - 1.8f,
                                5f,
                                new Size(map.mSize.Width - MapHelper.GetColumnXAt(MapHelper.GetLastColumn() - 1.8f) - MapHelper.GetOffset(),
                                         map.mSize.Height - MapHelper.GetPlatformYAtLevel(0.6f) - MapHelper.GetOffset()),
                                Wall.Colors.WHITE);

            MapHelper.BuildPlatform(0, 6, MapHelper.GetLastColumn()-2, Wall.Colors.BLUE);

            MapHelper.BuildPlatform((MapHelper.GetLastColumn()/2)-3, 7, 4, Wall.Colors.BLUE);

            MapHelper.BuildPlatform(0, 7, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(0, 8, 1);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn()-2, 7, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn()-2, 8, 1);

            ExitDoorModel door1 = MapHelper.BuildExitDoor((MapHelper.GetLastColumn()/2)-1, 7, PlayerIndex.One);
            ExitDoorModel door2 = MapHelper.BuildExitDoor((MapHelper.GetLastColumn() / 2) - 3f, 7, PlayerIndex.Two);

            map.AssignExitDoors(ref door1, ref door2);

            return map;
        }
Example #6
0
        public static MapModel BuildSolo(Game game, Size mapSize, ref Character aChar)
        {
            MapModel map = new MapModel(game, mapSize, Score.GenerateDefaultScore(), "bg");
            MapHelper.SetPlayerInfo(aChar.JumpHeight, aChar.mSize);
            MapHelper.SetMap(ref map);

            MapHelper.BuildMapBorders();

            MapHelper.BuildResistor(2, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(2.9f, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(3.7f, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(4.5f, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(5.3f, 1, Resistor.Type.NEUTRAL);

            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 4, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 4.9f, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 5.7f, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 6.5f, 1, Resistor.Type.NEUTRAL);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 7.3f, 1, Resistor.Type.NEUTRAL);

            MapHelper.BuildCollectable((MapHelper.GetLastColumn() / 2) + 0.5f , 1, 1);
            MapHelper.BuildCollectable((MapHelper.GetLastColumn() / 2)-0.7f, 1, 1);
            MapHelper.BuildCollectable((MapHelper.GetLastColumn() / 2) - 1.8f, 1, 1);

            MapHelper.BuildPlatform(1, 1, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(1,2,1);
            MapHelper.BuildPlatform(0, 2, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(0, 3, 1);
            MapHelper.BuildPlatform(1, 3, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(1, 4, 1);
            MapHelper.BuildPlatform(0, 4, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(0, 5, 1);
            MapHelper.BuildPlatform(1, 5, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(1, 6, 1);
            MapHelper.BuildPlatform(0, 6, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(0, 7, 1);
            MapHelper.BuildResistor(0, 7, Resistor.Type.PLAYER_ONE);

            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 3, 1, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 3, 2, 1);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 2, 2, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 2, 3, 1);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 3, 3, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 3, 4, 1);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 2, 4, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 2, 5, 1);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 3, 5, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 3, 6, 1);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 2, 6, 1, Wall.Colors.BLUE);
            MapHelper.BuildCollectable(MapHelper.GetLastColumn() - 2, 7, 1);
            MapHelper.BuildResistor(MapHelper.GetLastColumn()-2, 7, Resistor.Type.PLAYER_TWO);

            MapHelper.BuildPlatform(3, 5, MapHelper.GetLastColumn() - 7, Wall.Colors.BLUE);
            MapHelper.BuildResistor(5, 6, Resistor.Type.PLAYER_ONE);
            MapHelper.BuildResistor(5.8f, 6, Resistor.Type.PLAYER_ONE);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 7, 6,Resistor.Type.PLAYER_TWO);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 7.8f, 6, Resistor.Type.PLAYER_TWO);

            MapHelper.BuildMoveableBox(4, 5.5f, new Size(40, 20));
            MapHelper.BuildMoveableBox(MapHelper.GetLastColumn()-6, 5.5f, new Size(40, 20));

            MapHelper.BuildPlatform(1, 7, MapHelper.GetLastColumn() - 3, Wall.Colors.BLUE);
            ElevatorModel e1 = MapHelper.BuildElevator(3.3f, 8.5f,1,0.8f);
            ElevatorModel e2 = MapHelper.BuildElevator(MapHelper.GetLastColumn() - 5.7f, 8.5f, 1, 0.8f);
            MapHelper.BuildResistor(3, 8, Resistor.Type.PLAYER_TWO);
            MapHelper.BuildResistor(3.8f, 8, Resistor.Type.PLAYER_TWO);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 6, 8, Resistor.Type.PLAYER_ONE);
            MapHelper.BuildResistor(MapHelper.GetLastColumn() - 5.2f, 8, Resistor.Type.PLAYER_ONE);
            SwitchModel s1 = MapHelper.BuildSwitch(3.5f, 5);
            SwitchModel s2 = MapHelper.BuildSwitch(MapHelper.GetLastColumn()-4.5f, 5);
            MapHelper.RegisterSwitchToElevator(ref s1, ref e1);
            MapHelper.RegisterSwitchToElevator(ref s2, ref e2);

            MapHelper.BuildPlatform(0, 8, 2, Wall.Colors.BLUE);
            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 3, 8, 2, Wall.Colors.BLUE);
            ExitDoorModel door1 = MapHelper.BuildExitDoor(0, 8, PlayerIndex.One);
            ExitDoorModel door2 = MapHelper.BuildExitDoor(MapHelper.GetLastColumn()-3, 8, PlayerIndex.Two);

            map.AssignExitDoors(ref door1, ref door2);

            return map;
        }
Example #7
0
        public static MapModel BuildLevel3(Game game, 
                                           Size mapSize,
                                           ref Character aChar)
        {
            MapModel map = new MapModel(game, mapSize, Score.GenerateDefaultScore(), "bg");
            MapHelper.SetPlayerInfo(aChar.JumpHeight, aChar.mSize);
            MapHelper.SetMap(ref map);

            MapHelper.BuildMapBorders();
            MapHelper.BuildPlatform(0, 1, 6, Wall.Colors.WHITE);

            MapHelper.BuildCollectable(0, 1,1);
            MapHelper.BuildCollectable(1, 1, 1);
            MapHelper.BuildCollectable(2, 1, 1);
            MapHelper.BuildCollectable(3, 1, 1);

            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 2, 1, 2, Wall.Colors.WHITE);
            MapHelper.BuildPlatform(0, 2, MapHelper.GetLastColumn() - 2, Wall.Colors.WHITE);
            SwitchModel switch1 = MapHelper.BuildSwitch(5, 2);

            ElevatorModel elev1 = MapHelper.BuildElevator(0, 4f);

            MapHelper.RegisterSwitchToElevator(ref switch1, ref elev1);

            MapHelper.BuildPlatform(MapHelper.GetDefaultElevatorColumnSpan(), 4, MapHelper.GetLastColumn() - MapHelper.GetDefaultElevatorColumnSpan(), Wall.Colors.WHITE);
            SwitchModel switch12 = MapHelper.BuildSwitch(5, 4);

            MapHelper.RegisterSwitchToElevator(ref switch12, ref elev1);

            MapHelper.BuildPlatform(MapHelper.GetLastColumn() - 2, 5, 2, Wall.Colors.WHITE);

            MapHelper.BuildPlatform(0, 6, MapHelper.GetLastColumn() - 2, Wall.Colors.WHITE);

            MapHelper.BuildPlatform(5, 7, 7, Wall.Colors.WHITE);

            ExitDoorModel door1 = MapHelper.BuildExitDoor(6, 7, PlayerIndex.One);
            ExitDoorModel door2 = MapHelper.BuildExitDoor(8, 7, PlayerIndex.Two);

            map.AssignExitDoors(ref door1, ref door2);

            MapHelper.BuildMoveableBox(7, 6, new Size(30,20));

            MapHelper.BuildResistor(8, 1, Resistor.Type.PLAYER_ONE);

            return map;
        }
Example #8
0
        public static MapModel BuildLevel2(Game game,
                                          Size mapSize,
                                          ref Character aChar)
        {
            MapModel map = new MapModel(game, mapSize, Score.GenerateDefaultScore(), "bg");
            MapHelper.SetPlayerInfo(aChar.JumpHeight, aChar.mSize);
            MapHelper.SetMap(ref map);

            MapHelper.BuildMapBorders();

            MapHelper.BuildPlatform(0, 1.2f, 5, Wall.Colors.BLUE);
            MapHelper.BuildWall(MapHelper.GetLastColumn() - 3,
                                1,
                                new Size(map.mSize.Width - MapHelper.GetColumnXAt(MapHelper.GetLastColumn()-3) - MapHelper.GetOffset(),
                                         map.mSize.Height - MapHelper.GetPlatformYAtLevel(1) - MapHelper.GetOffset()),
                                Wall.Colors.WHITE);

            MapHelper.BuildPlatform(7, 2f, 7, Wall.Colors.BLUE);
            MapHelper.BuildWall(7,2,new Size(MapHelper.GetOffset(), MapHelper.GetOffset()), Wall.Colors.BLUE);
            MapHelper.BuildPlatform(0, 3f, 7, Wall.Colors.BLUE);

            SwitchModel switch1 = MapHelper.BuildSwitch(5, 3);
            ElevatorModel elev1 = MapHelper.BuildElevator(0, 5.5f,1.5f,2.7f);

            MapHelper.RegisterSwitchToElevator(ref switch1, ref elev1);

            ExitDoorModel door1 = MapHelper.BuildExitDoor(6, 7, PlayerIndex.One);
            ExitDoorModel door2 = MapHelper.BuildExitDoor(8, 7, PlayerIndex.Two);

            map.AssignExitDoors(ref door1, ref door2);

            return map;
        }