示例#1
0
    public override void _Ready()     // initialization here
    {
        // ap.Connect("finished", this, nameof(onAudioStreamPlayerFinished));
        GetViewport().Connect("size_changed", this, nameof(onViewportSizeChanged));

        Log.debug = true;
        s         = ship.Instance() as RigidBody2D;
        s.SetPosition(new Vector2(10000f, 10000f));
        // cam.MakeCurrent();
        s.AddChild(myCam);
        myCam.MakeCurrent();
        // var p = (CPUParticles2D)GetNode("ParallaxBackground/ParallaxLayer/CPUParticles2D");
        // Log.p("p emmiting: " + p.Emitting);
        // p.Emitting = true;
        // Log.p(myCam.AnchorMode);

        myCam.SetZoom(new Vector2(1.5f, 1.5f));
        myCam.DragMarginLeft   = 0;
        myCam.DragMarginRight  = 0;
        myCam.DragMarginTop    = 0;
        myCam.DragMarginBottom = 0;
        // myCam.SmoothingEnabled = true;

        AddChild(s);
        Log.p("AddChild(s.ship)");

        GetNode("Ship").Connect("Shoot", this, nameof(onShipShoot));
        // GetNode("/root/Bullet").Connect("area_entered", this, nameof(holyShit));

        Log.p("Me Parnet: " + GetParent());
        Log.p("Me viwpotre: " + GetViewport());
        Log.p("metree: " + GetTree());
        Log.p("me hut: " + GetTree().GetRoot());
        foreach (Godot.Object n in GetViewport().GetChildren())
        {
            Log.p("lol -> " + n);
        }
        Log.p("suck my frog: " + GetTree().GetRoot().GetPath());
    }