Skip to main content

SCRIPT_BOILERPLATE

Constant SCRIPT_BOILERPLATE 

Source
const SCRIPT_BOILERPLATE: &str = r#"// Called once when this script starts (Play begins, or the script is attached mid-Play).
let on_start = || {
};

// Called every frame while playing.
// `dt` is the elapsed time in seconds since the last frame.
// `input` lets you check keys, e.g. input.is_held("KeyW") or input.is_pressed("Space").
let on_update = |dt, input| {
};
"#;
Expand description

Starter content for Project::create_script’s “New Script” boilerplate — both hooks [libdqg::scripting::ScriptRuntime] looks for, stubbed out. on_start/on_update must stay let-bound closures rather than plain fns (see ScriptRuntime::start_script’s doc comment on why) — this template exists partly so a new script starts from a working example of that, not just a blank file.