Beispiel #1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Beispiel #2
0
 public ShopSprite(Texture2D textureImage, Vector2 position, int collisionOffset, Mapper mapper, Game1 gameRef)
     : base(textureImage, position, new Point(32, 32), 0, new Point(0, 0), new Point(0, 0), Vector2.Zero)
 {
     this.gameRef = gameRef;
     this.zIndex = .2f;
     passable = false;
     this.isInteractable = true;
     this.interactOnTouch = false;
 }
 public AutomatedSprite(Texture2D textureImage, Vector2 position,
    Point frameSize, int collisionOffset, Point currentFrame, Point sheetSize,
    Vector2 speed, Game1 game)
     : base(textureImage, position, frameSize, collisionOffset, currentFrame, sheetSize, speed)
 {
     this.game = game;
     this.zIndex = .2f;
     this.isInteractable = true;
 }
 public SpriteManager(Game game, PlayerCharacter userCharacter)
     : base(game)
 {
     GameRef = (Game1)game;
     pc = userCharacter;
     // TODO: Construct any child components here
     player = new UserControlledSprite(Game.Content.Load<Texture2D>(@"Images/player"),
     new Vector2(64, 64), new Point(27, 31), 0, new Point(0, 0),
     new Point(0, 0), new Vector2(3, 3), pc, GameRef, mapper, 2f);
 }
Beispiel #5
0
 public Door(Texture2D textureImage, Vector2 position, int collisionOffset, string mapLink, Mapper mapper, Vector2 PlacementOnMove, Game1 game)
     : base(textureImage, position, new Point(32, 32), -25, new Point(0, 0), new Point(0, 0), Vector2.Zero, game)
 {
     this.mapLink = mapLink;
     this.zIndex = .5f;
     this.mapper = mapper;
     this.passable = false;
     this.isInteractable = true;
     this.placementOnMove = PlacementOnMove;
 }
Beispiel #6
0
        public Mapper(SpriteManager s, Game1 g)
        {
            manager = s;
            gameRef = g;
            FileIn = new FileInputHandler(gameRef);

            List<string> basicList = new List<string>();
            basicList.Add("SporeWeed");
            basicList.Add("VioletWing");
            List<string> earthList = new List<string>();
            earthList.Add("SporeWeed");
            earthList.Add("Titan");
            earthList.Add("ToxWyrm");
            List<string> fireList = new List<string>();
            fireList.Add("ToxWyrm");
            fireList.Add("Titan");
            List<string> windList = new List<string>();
            windList.Add("VioletWing");
            windList.Add("Naga");
            List<string> waterList = new List<string>();
            waterList.Add("Naga");
            waterList.Add("SporeWeed");

            map01 = new Map("Map01", gameRef, this, basicList);
            mapF1 = new Map("MapF1", gameRef, this, fireList);
            mapF2 = new Map("MapF2", gameRef, this, fireList);
            mapF3 = new Map("MapF3", gameRef, this, fireList);
            mapW1 = new Map("MapW1", gameRef, this, waterList);
            mapW2 = new Map("MapW2", gameRef, this, waterList);
            mapW3 = new Map("MapW3", gameRef, this, waterList);
            mapE1 = new Map("MapE1", gameRef, this, earthList);
            mapE2 = new Map("MapE2", gameRef, this, earthList);
            mapE3 = new Map("MapE3", gameRef, this, earthList);
            mapA1 = new Map("MapA1", gameRef, this, windList);
            mapA2 = new Map("MapA2", gameRef, this, windList);
            mapA3 = new Map("MapA3", gameRef, this, windList);
            map06 = new Map("Map06", gameRef, this, basicList);
            map07 = new Map("Map07", gameRef, this, basicList);
            maps.Add("01", map01);
            maps.Add("F1", mapF1);
            maps.Add("F2", mapF2);
            maps.Add("F3", mapF3);
            maps.Add("W1", mapW1);
            maps.Add("W2", mapW2);
            maps.Add("W3", mapW3);
            maps.Add("E1", mapE1);
            maps.Add("E2", mapE2);
            maps.Add("E3", mapE3);
            maps.Add("A1", mapA1);
            maps.Add("A2", mapA2);
            maps.Add("A3", mapA3);
            maps.Add("06", map06);
            maps.Add("07", map07);
        }
Beispiel #7
0
 public BossSprite(Texture2D textureImage, Vector2 position,
    Point frameSize, int collisionOffset, Point currentFrame, Point sheetSize,
    Vector2 speed, Game1 game, Enemy boss)
     : base(textureImage, position, frameSize, collisionOffset, currentFrame, sheetSize, speed, game)
 {
     this.game = game;
     this.zIndex = .2f;
     passable = false;
     this.isInteractable = true;
     this.interactOnTouch = true;
     this.Boss = boss;
 }
 public UserControlledSprite(Texture2D textureImage, Vector2 position,
     Point frameSize, int collisionOffset, Point currentFrame, Point sheetSize,
     Vector2 speed, PlayerCharacter pc, Game1 game, Mapper mapperInput, float zIndex = .1f)
     : base(textureImage, position, frameSize, collisionOffset, currentFrame, sheetSize, speed)
 {
     this.zIndex = zIndex;
     Character = pc;
     GameRef = game;
     this.mapper = mapperInput;
     baseSpeed = speed;
     halfSpeed = speed / 2;
 }
Beispiel #9
0
 public InputHandler(Game1 game)
     : base(game)
 {
     keyboardState = Keyboard.GetState();
 }
 public GameStateManeger(Game1 game)
     : base(game)
 {
     drawOrder = startDrawOrder;
 }
Beispiel #11
0
        public Map(string fileName, Game1 game, Mapper mapper, List<String> enemyList)
        {
            FileInputHandler fileIn = new FileInputHandler(game);
            tiles = fileIn.parseToArray(fileName);
            this.gameRef = game;
            this.mapper = mapper;
            this.enemyList = enemyList;

            loadList = new List<Sprite>();
            int dim = 16;
            string s = "";

            for (int x = 0; x < dim; x++)
            {
                for (int y = 0; y < dim; y++)
                {
                    Vector2 position = new Vector2(x * 64, y * 64);
                    s = this.tiles[y, x];
                    //if (s.Equals("0"))
                    //{
                    //    ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                    //    loadList.Add(ts);
                    //}
                    if (s.Contains("map_"))
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        loadList.Add(ts);
                        string selectedBoss = s.Substring(s.IndexOf("_") + 1);
                        Enemy bossObject;
                        switch (selectedBoss)
                        {
                            case "clark":
                                bossObject = new Clark(gameRef.Character.Level, gameRef, gameRef.Character);
                                break;
                            case "pay":
                                bossObject = new JerryPay(gameRef.Character.Level, gameRef, gameRef.Character);
                                break;
                            case "fletcher":
                                bossObject = new Fletcher(gameRef.Character.Level, gameRef, gameRef.Character);
                                break;
                            case "halliday":
                                bossObject = new Halliday(gameRef.Character.Level, gameRef, gameRef.Character);
                                break;
                            case "king_james":
                                bossObject = new Boss(gameRef.Character.Level, gameRef, gameRef.Character);
                                break;
                            default:
                                bossObject = new Clark(gameRef.Character.Level, gameRef, gameRef.Character);
                                break;
                        }
                        BossSprite combatSprite = new BossSprite(gameRef.Content.Load<Texture2D>(@"Images/map" + s.Substring(s.IndexOf('_'))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero, gameRef, bossObject);
                        loadList.Add(combatSprite);
                    }
                    else if (s.Contains("3d"))
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        ts.passable = false;
                        loadList.Add(ts);
                    }
                    else if (s.Contains("i"))
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        Treasure t = new Treasure(gameRef.Content.Load<Texture2D>(@"Images/mapItem"), position, 0, mapper, gameRef);
                        loadList.Add(ts);
                        loadList.Add(t);
                    }
                    else if (s.Contains("d"))
                    {
                        int i = 0;
                        string mapID = s.Substring(1, 2);

                        float placeAtX = (float.Parse(s.Substring(s.IndexOf(";") + 1, 2))) * 64;
                        float placeAtY = (float.Parse(s.Substring(s.IndexOf("_") + 1, 2))) * 64;
                        Door d = new Door(gameRef.Content.Load<Texture2D>(@"Images/tiled"), position, 0, mapID, mapper, new Vector2(placeAtX, placeAtY), gameRef);
                        d.passable = false;
                        d.isInteractable = true;
                        loadList.Add(d);
                    }
                    else if (s.Contains("k"))
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        Key k = new Key(gameRef.Content.Load<Texture2D>(@"Images/key"), position, 0, mapper, gameRef);
                        loadList.Add(ts);
                        loadList.Add(k);
                    }

                    else if (s.Contains("l"))
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        LockedDoor ld = new LockedDoor(gameRef.Content.Load<Texture2D>(@"Images/lockedDoor"), position, 0, mapper, gameRef);
                        loadList.Add(ts);
                        loadList.Add(ld);
                    }
                    else if (s.Contains("s"))
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + (s.Substring(0, 1))), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        ts.passable = false;
                        ShopSprite ss = new ShopSprite(gameRef.Content.Load<Texture2D>(@"Images/shop"), position, 25, mapper, gameRef);
                        loadList.Add(ts);
                        loadList.Add(ss);
                    }
                    else if (s == "0")
                    {
                        int wallType = r.Next(0, 9);
                        switch (wallType)
                        {
                            case 0:
                                break;
                            case 1:
                                wallType = 0;
                                break;
                            case 2:
                                wallType = 1;
                                break;
                            case 3:
                                wallType = 1;
                                break;
                            case 4:
                                wallType = 2;
                                break;
                            case 5:
                                wallType = 2;
                                break;
                            case 6:
                                wallType = 3;
                                break;
                            case 7:
                                wallType = 1;
                                break;
                            case 8:
                                wallType = 2;
                                break;
                        }
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/wallTile" + wallType), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        ts.passable = false;
                        loadList.Add(ts);
                    }
                    else
                    {
                        ts = new TileSprite(gameRef.Content.Load<Texture2D>(@"Images/tile" + s), position, new Point(32, 32), -25, new Point(0, 0), new Point(1, 1), Vector2.Zero);
                        if (s == "0" || s == "b")
                        { ts.passable = false; }
                        loadList.Add(ts);
                    }
                }
            }
        }