コード例 #1
0
ファイル: Game.cs プロジェクト: thetornadotitan/godot_pong
    private void InitBall()
    {
        ballSpeed             = ballStartSpeed;
        ball                  = GetNode(new NodePath("./Ball")) as KinematicBody2D;
        ballVisibilityChecker = ball.GetChild(2) as VisibilityNotifier2D;
        ballStartPos          = ball.Position;

        RandomizeBallVelocity();

        shooter = (Math.Sign(ballVel.x) == -1) ? true : false;
    }
コード例 #2
0
    public void remove_new_player()     // Maybe some UI that shows how much time is left on the powerup
    {
        GD.Print("aaaaaaaaaaa");        // timer doesn't f*****g start only whenever it feels like it
        Timer           live_time = (Timer)GetTree().Root.GetNode("Main").GetNode("Grow_Live_Time");
        KinematicBody2D player    = (KinematicBody2D)GetTree().Root.GetNode("Main").GetNode("Player");

        //Godot.Collections.Array children = player.GetChildren();
        //for (int i = 2; i < player.GetChildCount(); i += 1)
        //{
        //	((KinematicBody2D)children[i]).QueueFree();
        //}
        //if (player.GetChildCount() >= 4 && player.GetChild(3) != null)
        //{
        //	player.GetChild(3).QueueFree();
        //}
        new_player_spawned = false;
        player.GetChild(2).QueueFree();
        live_time.QueueFree();
    }