Skip to content

Conversation

dylanmccall
Copy link
Contributor

@dylanmccall dylanmccall commented Sep 19, 2024

An example of this in use:

Screenshot From 2024-09-19 12-02-53

We can't see the generated code in the debugger (or at least I don't know how to reach it), but we can inspect local variables and the Godot objects they are referencing, which can be fairly useful.

This block adds the "breakpoint" keyword, which pauses execution when
debugging an application.
@dylanmccall dylanmccall marked this pull request as ready for review September 19, 2024 18:58
@dylanmccall dylanmccall requested a review from manuq September 19, 2024 19:06
Copy link
Contributor

@starnight starnight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting feature! Thanks!

I add a Breakpoint block into BlockCode directly:
image
The generated code is:

extends SimpleCharacter


func _process(delta):
    move_with_player_buttons('player_1', 'platformer', delta)
    if (Input.is_action_just_pressed('ui_right')):
        rotation_degrees += 5
        position += Vector2(1, 0)
        breakpoint
    if (Input.is_action_pressed('ui_left')):
        rotation_degrees += -5
        position += Vector2(-1, 0)

It breaks at it and shows the Stack Trace:
image

@starnight starnight merged commit bffd9b9 into main Sep 20, 2024
3 checks passed
@starnight starnight deleted the add-breakpoint-block branch September 20, 2024 03:45
@manuq
Copy link
Contributor

manuq commented Sep 20, 2024

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants