Topic: debug tools

here's a couple of objects that will help you debug player-related issues.

notice that they are not completely adapted to Open Surge, because it was developed for SD. everything is compatible but there are no readings of some actions and you may need to add them yourself. if you do please share with us so i can update the code below.

you need to have a script do

create_child ".player_debug"

especially useful in the default startup script.

if you want to add more objects to do separate readings without interfering with the working of this ones, create them as child in the "main" state of ".player_debug"

object ".player_debug"
{
requires 0.2.0
always_active
detach_from_camera
    
    state "main"
    {
    create_child ".player_action"
    change_state "active"
    }
    state "active"
    {
    hide
    let "$xspd = round(player_xspeed())"
    let "$yspd = round(player_yspeed())"
    let "$Mps = round (abs($xspd/32))"
    let "$Ftps = $Mps*0.3048"
    let "$x = round(player_xpos())"
    let "$y = round(player_ypos())"
    let "$angle = player_angle()"
    
    textout "default" 0 0 "X = $x  Y = $y Angle = $angle"
    textout "default" 0 16 "Xspd = $xspd Yspd = $yspd M/s = $Mps F/s = $Ftps"
    }
}
    
object ".player_action"
{
requires 0.2.0
always_active
detach_from_camera

    state "main"
    {
    hide
    on_player_stop "stop"
    on_player_walk "walk"
    on_player_run "run"
    on_player_duck "duck"
    if "player_yspeed() < 0" "jump"
    on_player_in_the_air "air"
    on_player_brake "brake"
    }
    state "stop"
    {
    textout "default" 0 32 "Stopped"
    on_player_duck "duck"
    change_state "main"
    }
    state "walk"
    {
    textout "default" 0 32 "Walking"
    on_player_walk "walk"
    change_state "main"
    }
    state "run"
    {
    textout "default" 0 32 "Running"
    on_player_run "run"
    change_state "main"
    }
    state "duck"
    {
    textout "default" 0 32 "Ducking"
    on_player_duck "duck"
    change_state "main"
    }
    state "jump"
    {
    textout "default" 0 32 "Jumping"
    if "player_yspeed() < 0" "jump"
    change_state "main"
    }
    state "air"
    {
    textout "default" 0 32 "In the air"
    on_player_in_the_air "air"
    change_state "main"
    }
    state "brake"
    {
    textout "default" 0 32 "Braking"
    on_player_brake "brake"
    change_state "main"
    }
}

as a last note, the Meters per second, and Feet per second readings are based in a scale where

32 pixels = 1 meter = 0.3048 feet
https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png