Ejemplo n.º 1
0
        /// <summary>
        /// initializes the platformer game
        /// </summary>
        protected override void Initialize()
        {
            //IsMouseVisible = true;
            Window.Title = "Geimu 2";
            ChangeResolution(1024, 768);

            Engine = new PEngine(this);
            PEngine.NameToType["obj_block"]        = typeof(BlockObject); //if there is a better way to go about doing this please tell
            PEngine.NameToType["obj_player"]       = typeof(PlayerObject);
            PEngine.NameToType["obj_item"]         = typeof(ItemObject);
            PEngine.NameToType["obj_upgrade"]      = typeof(UpgradeObject);
            PEngine.NameToType["obj_enemy"]        = typeof(EnemyObject);
            PEngine.NameToType["obj_boss"]         = typeof(BossObject);
            PEngine.NameToType["obj_win"]          = typeof(GameWinObject);
            PEngine.NameToType["obj_lose"]         = typeof(GameOverObject);
            PEngine.NameToType["obj_camera"]       = typeof(CameraObject);
            PEngine.NameToType["obj_crosshair"]    = typeof(CrosshairObject);
            PEngine.NameToType["obj_jumpparticle"] = typeof(JumpParticleObject);
            PEngine.NameToType["obj_jumpreset"]    = typeof(JumpResetObject);
            PEngine.NameToType["obj_goalblock"]    = typeof(GoalBlockObject);
            PEngine.NameToType["obj_fairy"]        = typeof(FairyObject);
            PEngine.NameToType["obj_damageblock"]  = typeof(DamageBlockObject);
            PEngine.NameToType["tle_stonebrick"]   = typeof(StoneBrickTile);
            PEngine.NameToType["tle_dirt"]         = typeof(DirtTile);
            PEngine.NameToType["tle_stone"]        = typeof(StoneTile);

            Engine.ChangeRoom((new Room(Engine)).Load("Levels/level2.json"));

            base.Initialize();
        }
Ejemplo n.º 2
0
        public void GoToRoom(int x, int y)
        {
            if (x >= RoomMapWidth)
            {
                x = RoomMapWidth - 1;
            }
            if (y >= RoomMapHeight)
            {
                y = RoomMapHeight - 1;
            }
            if (x < 0)
            {
                x = 0;
            }
            if (y < 0)
            {
                y = 0;
            }
            BossObject bossObject = ((BossObject)Engine.CurrentRoom.FindObject("obj_boss"));

            if (bossObject != null)
            {
                bossObject.Position += new Vector2((CurrentRoomX - x) * 1024, (CurrentRoomY - y) * 768);
            }
            CurrentRoomX = x;
            CurrentRoomY = y;
            ConsoleManager.WriteLine("room position x: " + CurrentRoomX + ", y: " + CurrentRoomY);
            Engine.ChangeRoom(RoomMap[x, y]);
            MaxTimerLength -= 60;
            Timer           = MaxTimerLength;
        }