Exemplo n.º 1
0
    private void GetNodes()
    {
        // If in editor, skip.
        if (!GetTree().GetRoot().HasNode("Game"))
        {
            return;
        }

        GameNode        = GetTree().GetRoot().GetNode("Game") as Node2D;
        FirstSpellSlot  = GameNode.GetNode("UI/Screen/SelectedSpell") as Control;
        SecondSpellSlot = GameNode.GetNode("UI/Screen/SecondSpell") as Control;

        // TODO: Add path support.
        LoadLevel("res://editorLevel.tscn"); // Load level.

        CurrentLevel = GameNode.GetNode("CurrentLevel") as Level;
        Entities     = CurrentLevel.GetNode("Layers/Entities") as YSort;

        InGameMode = true;

        // Spawn Player.
        CurrentLevel.SpawnPlayer();
        Hand = Entities.GetNode("Player/Hand") as Hand;

        if (CurrentLevel is null)
        {
            GD.PrintErr("[GAME] Current Level not found");
        }
    }
Exemplo n.º 2
0
 public override void _Ready()
 {
     _chestGUI                    = GetNode <ChestGUI>("ChestGUI");
     _objectsYSort                = GetNode <YSort>("Objects");
     _player                      = _objectsYSort.GetNode <Player>("Player");
     _pauseMenu                   = GetNode <PauseMenu>("PauseMenu");
     _guildInterface              = GetNode <GuildInterface>("GuildInterface");
     _extendedTileMap             = GetNode <TileMap>("Extended");
     _firstChestPosition          = GetNode <Position2D>("FirstChestPosition").Position;
     _rightBorder                 = GetNode <CollisionShape2D>("Borders/Right");
     _player.birdsSystem.Visible  = false;
     _player.cloudsSystem.Visible = false;
     UpdateGuildFromLevel();
 }
Exemplo n.º 3
0
        public override void _Ready()
        {
            _map             = GetNode <YSort>("Map");
            _enemySpawns     = GetNode <Node2D>("EnemySpawns");
            _combat          = GetNode <Combat>("Combat");
            _combatMenu      = _combat.GetNode <CombatMenu>("CombatMenu");
            _pauseMenu       = GetNode <PauseMenu>("PauseMenu");
            _player          = _map.GetNode <Player>("Player");
            _droppedItemsGUI = GetNode <DroppedItems>("DroppedItems");

            _player.birdsSystem.Visible  = true;
            _player.cloudsSystem.Visible = true;

            _player.Position = SaveManager.SaveData.WorldPosition;

            if (!AudioSystem.IsMusicPlaying)
            {
                AudioSystem.PlayMusic(AudioSystem.MusicCollection.Overworld);
            }

            SpawnEnemies();
        }