Beispiel #1
0
        public Rock(EntityPreset preset, Player p)
            : base(preset.Position, 16, 16, DrawOrder.ENTITIES)
        {
            immovable = true;
            scene     = preset.Frame == 17 ? "melos" : "marina";

            string texName = "note_rock";
            int    f       = 0;

            if (GlobalState.CURRENT_MAP_NAME == "SPACE")
            {
                texName = "space_npcs";

                f = MapUtilities.GetRoomCoordinate(Position).X > 5 ? 31 : 30;
            }
            else if (GlobalState.CURRENT_MAP_NAME == "TRAIN")
            {
                f = 1;
            }

            SetTexture(texName);

            SetFrame(f);

            scene = MathUtilities.IntToString(preset.Frame + 1);
        }
Beispiel #2
0
        private void LoadMap()
        {
            TileData.SetTileset(GlobalState.CURRENT_MAP_NAME);
            _map.LoadMap(MapLoader.GetMap(GlobalState.CURRENT_MAP_NAME), TileData.Tiles, DrawOrder.MAP_BG);

            _map_bg_2.LoadMap(MapLoader.GetMap(GlobalState.CURRENT_MAP_NAME, 2), TileData.Tiles, DrawOrder.MAP_BG2);
            _map_bg_2.y = HEADER_HEIGHT;
            _map_fg.LoadMap(MapLoader.GetMap(GlobalState.CURRENT_MAP_NAME, 3), TileData.Tiles, DrawOrder.MAP_FG);
            _map_fg.y = HEADER_HEIGHT;

            //Sets tile collission and tile events
            TileData.Set_tile_properties(_map, _map_bg_2);
            _player.Position = _map.GetFirstWalkable(_map_bg_2) * TILE_WIDTH;

            Vector2 gridPos = MapUtilities.GetRoomCoordinate(_player.Position);
            Vector2 roomPos = MapUtilities.GetRoomUpperLeftPos(gridPos);

            GlobalState.CURRENT_GRID_X = (int)gridPos.X;
            GlobalState.CURRENT_GRID_Y = (int)gridPos.Y;

            _player.Reset();

            _camera.GoTo(roomPos);

            UpdateScreenBorders();

            foreach (EntityPreset p in EntityManager.GetMapEntities(GlobalState.CURRENT_MAP_NAME).Where(p => p.Permanence == Permanence.MAP_LOCAL))
            {
                p.Alive = true;
            }

            LoadGridEntities();

            _keyValueLabel.SetText($"x{InventoryManager.GetCurrentMapKeys()}");

            PlayMapMusic();

            UpdateBroomIcon();

            if (GlobalState.GameMode != GameMode.Normal)
            {
                ReloadMapTextures();
            }
        }