Exemple #1
0
 public void AddRegion(char tileKey, GameObject region)
 {
     //can only have one region per key
     if (!tileRegions.ContainsKey(tileKey))
         tileRegions.Add(tileKey, region);
     else
         throw new Exception("Can only have one region per key");
 }
Exemple #2
0
 public void LoadObj(GameObject go)
 {
     obj = go;
 }
Exemple #3
0
        protected override void Initialize()
        {
            this.IsMouseVisible = true;
            Window.AllowUserResizing = true;
            camera = new Camera(GraphicsDevice.Viewport);

            windowBlock = new GameObject();
            windowBlock.initializeMovement(new Vector3(0,0,0),
                new Vector3(0, 0, 0));
            topBlock = new GameObject();
            topBlock.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));
            rightBlock = new GameObject();
            rightBlock.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));
            leftBlock = new GameObject();
            leftBlock.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));
            rightCornerBlock = new GameObject();
            rightCornerBlock.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));
            leftCornerBlock = new GameObject();
            leftCornerBlock.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));
            porchBlock = new GameObject();
            porchBlock.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));
            backgroundBlocks = new GameObject();
            backgroundBlocks.initializeMovement(new Vector3(0, 100, -4000), new Vector3(0, 0, 0));

            player = new GameObject();
            player.initializeMovement(new Vector3(0, 0, 0),
                new Vector3(0, 0, 0));

            map1 = new Map(Content, Path.Combine(Content.RootDirectory, "level1.txt"),
               new Point(100, 100), '*', 'P');
            map1.AddRegion('P', player);
            map1.AddRegion('X', windowBlock);
            map1.AddRegion('T', topBlock);
            map1.AddRegion('>', rightBlock);
            map1.AddRegion('<', leftBlock);
            map1.AddRegion('E', windowBlock); // enemy
            map1.AddRegion('B', windowBlock); // boss
            map1.AddRegion('R', porchBlock);
            map1.AddRegion('A', leftCornerBlock);
            map1.AddRegion('C', rightCornerBlock);
            map1.AddBackground(backgroundBlocks);
            level1 = new Level(map1);
            currentGameState = GameState.TitleScreen;

            base.Initialize();
        }
Exemple #4
0
 public void AddBackground(GameObject bgAsset)
 {
     background = bgAsset;
 }