예제 #1
0
    public void LoadLevel()
    {
        var ogmo  = new OgmoLoader();
        var level = ogmo.Load(out Overlord.Player, out Overlord.LevelBoundsX, out Overlord.LevelBoundsY);

        Viewport root         = GetTree().GetRoot();
        var      CurrentScene = root.GetChild(root.GetChildCount() - 1);

        if (Overlord.Player != null)
        {
            CurrentScene.CallDeferred("add_child", Overlord.Player);
        }
        CurrentScene.CallDeferred("add_child", level);
    }
예제 #2
0
파일: G.cs 프로젝트: jdaiv/bomb-game
    public void Awake( )
    {
        I = this;

        players = new P();

        cameraPos = mainCamera.transform.position;

        animations = new Sprite[][] {
            U.SliceSprite(sprites[7], 9),
            U.SliceSprite(sprites[8], 5),
            U.SliceSprite(sprites[11], 5),
            U.SliceSprite(sprites[12], 5),
            U.SliceSprite(sprites[13], 7),
            // 5 -------------------------------
            U.SliceSprite(sprites[14], 7),
            U.SliceSprite(sprites[18], 4),
            U.SliceSprite(sprites[19], 10),            // Golf Club
            U.SliceSprite(sprites[20], 13),            // LMG
            U.SliceSprite(sprites[21], 33),            // Grenade Launcher
            // 10 ------------------------------
            U.SliceSprite(sprites[24], 16),            // Laser Gun
            U.SliceSprite(sprites[25], 20),            // Shotgun
            U.SliceSprite(sprites[26], 3),             // RPG
            U.SliceSprite(sprites[28], 16),
        };

        InitTimer();
        InitSprites();
        InitEntities();
        InitSounds();

        OgmoLoader.Load();
        level = new Level();
        level.Generate();

        bulletTrails = new BulletTrails();
        particles    = new Particles();
        particles.RegisterSprite(animations[0]);
        particles.RegisterSprite(animations[4]);
        particles.RegisterSprite(animations[5]);
        particles.RegisterSprite(animations[13]);
        casings  = new BulletCasings();
        lighting = new Lighting();

        currentSpawn = 0;

        gameState = new GS_PreGame();
        StartCoroutine(gameState.Start());
    }
    // Declare member variables here. Examples:
    // private int a = 2;
    // private string b = "text";

    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        var    ogmo = new OgmoLoader();
        Node2D player;
        var    level = ogmo.Load(out player, out Overlord.LevelBoundsX, out Overlord.LevelBoundsY);

        Viewport root = GetTree().GetRoot();

        Overlord.ViewportSize = root.Size;
        var CurrentScene = root.GetChild(root.GetChildCount() - 1);

        if (player != null)
        {
            CurrentScene.CallDeferred("add_child", player);
        }
        CurrentScene.CallDeferred("add_child", level);
        //CurrentScene.AddChild(yeah);
    }