Exemple #1
0
 public Model(Game game,
              Pointf position,
              Size size,
              Velocity velocity)
     : this(game, position, size, velocity, 0)
 {
 }
Exemple #2
0
        public Character(Game game,
                            Pointf position,
                            Size size,
                            Velocity velocity,
                            PlayerIndex index
                        )
            : base(game, position, size, velocity)
        {
            EnableFreeFall();

            currentPlayer = index;
            if (currentPlayer == PlayerIndex.One)
            {
                mPlayerIndex = 0;
            }
            else if (currentPlayer == PlayerIndex.Two)
            {
                mPlayerIndex = 1;
            }
            else
            {
                mPlayerIndex = 2;
            }

            mSongJump = game.Content.Load<SoundEffect>("jump4");
        }
 public Displayable(Pointf position,
                    Size size,
                    Velocity velocity)
 {
     Position = new Pointf(position);
     Size = new Size(size);
     mVelocity = new Velocity(velocity);
 }
Exemple #4
0
        public MapModel(Game game, Size size, Score score, string backgroundName)
            : base(game, new Pointf(), size, new Velocity())
        {
            mScore = score;
            mMapComponents = new List<Model>();

            background = game.Content.Load<Texture2D>(backgroundName);
            bgFrame = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
        }
Exemple #5
0
 public Wall(Game game, Pointf position, Size size, Colors color)
     : base(game, position, size, new Velocity(), (int)color)
 {
     mBlocksOnCollision = true;
     isHorizontal = true;
     if (size.Height > size.Width)
     {
         isHorizontal = false;
     }
 }
 public ExampleModel(Game game,
                     Pointf position,
                     Size size,
                     Velocity velocity)
     : base(game, position, size, velocity, 0)
 {
     //  how you would move
     mPosition.X = 40;
     Velocity.Speed = new Vector2(1,1);
     Velocity.Direction = new Vector2(2, 0);
 }
Exemple #7
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;
        }
Exemple #8
0
        public Model(Game game,
                     Pointf position,
                     Size size,
                     Velocity velocity,
                     int parameterized)
            : base(game,
                 new Displayable(position, size, velocity), parameterized)
        {
            mDestroy = false;
            mId = idCntr++;
            mIsFreeFall = false;
            mFrames = new List<Frame>();
            GenerateFrames();

            mPosition.X += size.Width / 2;
            mPosition.Y += size.Height / 2;
        }
Exemple #9
0
 public static Wall BuildWall(Pointf wallPosition, Size wallSize, Wall.Colors wallColor)
 {
     var temp = GetMap();
     return BuildWall(wallPosition, wallSize, wallColor, ref temp);
 }
Exemple #10
0
 public static Wall BuildWall(Pointf wallPosition, Size wallSize, Wall.Colors wallColor, ref MapModel map)
 {
     Wall wall = new Wall(map.Game, new Pointf(wallPosition.X, wallPosition.Y), new Size(wallSize.Width, wallSize.Height), wallColor);
     map.AddComponent(wall);
     return wall;
 }
Exemple #11
0
 public static MoveableBox BuildMoveableBoxAtX(float posX, float platformLevel, Size boxSize)
 {
     var temp = GetMap();
     return BuildMoveableBoxAtX(posX, platformLevel, boxSize, ref temp);
 }
Exemple #12
0
 public static MoveableBox BuildMoveableBoxAtX(float posX, float platformLevel, Size boxSize, ref MapModel map)
 {
     return BuildMoveableBox(new Pointf(posX, GetPlatformYAtLevel(platformLevel, ref map)), boxSize, ref map);
 }
Exemple #13
0
 public Frame(Pointf position, Size size)
 {
     mArea = new Rectangle((int)position.X, (int)position.Y,
                           (int)size.Width, (int)size.Height);
 }
Exemple #14
0
 public static void SetPlayerInfo(float playerJump, Size playerSize)
 {
     DEFAULT_PLATFORM_WIDTH = playerSize.Width * 1.5f;
     DEFAULT_PLATFORM_HEIGHT = playerJump/1.5f;
 }
Exemple #15
0
 public static Wall BuildWallAtX(float posX, float platformLevel, Size wallSize, Wall.Colors wallColor, ref MapModel map)
 {
     return BuildWall(new Pointf(posX, GetPlatformYAtLevel(platformLevel, ref map)), wallSize, wallColor, ref map);
 }
Exemple #16
0
 public Size(Size other)
 {
     Width = other.Width;
     Height = other.Height;
 }
Exemple #17
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;
        }
Exemple #18
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;
        }
Exemple #19
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;
        }
Exemple #20
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;
        }
Exemple #21
0
 public MoveableBox(Game game, Pointf position, Size size)
     : base(game, position, size, new Velocity())
 {
     mBlockedWallId = -1;
     EnableFreeFall();
 }
Exemple #22
0
 public static Wall BuildWall(float column, float platformLevel, Size wallSize, Wall.Colors wallColor, ref MapModel map)
 {
     return BuildWall(GetPointForColumnAndLevel(column, platformLevel, ref map), wallSize, wallColor, ref map);
 }
Exemple #23
0
 public static Wall BuildWall(float column, float platformLevel, Size wallSize, Wall.Colors wallColor)
 {
     var temp = GetMap();
     return BuildWall(column, platformLevel, wallSize, wallColor, ref temp);
 }
Exemple #24
0
 public static MoveableBox BuildMoveableBox(Pointf boxPosition, Size boxSize)
 {
     var temp = GetMap();
     return BuildMoveableBox(boxPosition, boxSize, ref temp);
 }
Exemple #25
0
 public static Wall BuildWallAtX(float posX, float platformLevel, Size wallSize, Wall.Colors wallColor)
 {
     var temp = GetMap();
     return BuildWallAtX(posX, platformLevel, wallSize, wallColor, ref temp);
 }
Exemple #26
0
 public static MoveableBox BuildMoveableBox(float column, float platformLevel, Size boxSize, ref MapModel map)
 {
     return BuildMoveableBox(GetPointForColumnAndLevel(column, platformLevel, ref map), boxSize, ref map);
 }
Exemple #27
0
 public static MoveableBox BuildMoveableBox(Pointf boxPosition, Size boxSize, ref MapModel map)
 {
     MoveableBox box = new MoveableBox(map.Game, boxPosition, boxSize);
     map.AddComponent(box);
     return box;
 }
Exemple #28
0
 public static MoveableBox BuildMoveableBox(float column, float platformLevel, Size boxSize)
 {
     var temp = GetMap();
     return BuildMoveableBox(column, platformLevel, boxSize, ref temp);
 }