2024-02-03 11:24:17 -08:00
|
|
|
fn init(state) {
|
2024-02-04 11:45:49 -08:00
|
|
|
|
|
|
|
conf_set_starfield(true);
|
|
|
|
conf_set_phys(true);
|
|
|
|
|
|
|
|
add_sprite(
|
2024-02-03 07:33:10 -08:00
|
|
|
"ring",
|
|
|
|
"ui::status",
|
|
|
|
Rect(
|
|
|
|
-5.0, -5.0, 100.0, 100.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthEast,
|
|
|
|
Anchor::NorthEast
|
2024-02-03 07:33:10 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_radialbar(
|
2024-02-03 07:33:10 -08:00
|
|
|
"shield", 2.5,
|
|
|
|
Color(0.3, 0.6, 0.8, 1.0),
|
|
|
|
Rect(
|
|
|
|
-9.5, -9.5, 91.0, 91.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthEast,
|
|
|
|
Anchor::NorthEast
|
2024-02-03 07:33:10 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
add_radialbar(
|
2024-02-03 07:33:10 -08:00
|
|
|
"hull", 2.5,
|
|
|
|
Color(0.8, 0.7, 0.5, 1.0),
|
|
|
|
Rect(
|
|
|
|
-13.5, -13.5, 83.0, 83.0,
|
2024-02-04 11:45:49 -08:00
|
|
|
Anchor::NorthEast,
|
|
|
|
Anchor::NorthEast
|
2024-02-03 07:33:10 -08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-02-03 11:24:17 -08:00
|
|
|
fn event(state, event) {
|
|
|
|
if type_of(event) == "PlayerShipStateEvent" {
|
|
|
|
if state.player_ship().is_landed() {
|
2024-02-04 11:45:49 -08:00
|
|
|
go_to_scene("landed");
|
|
|
|
return;
|
2024-02-03 11:24:17 -08:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2024-02-03 18:35:32 -08:00
|
|
|
}
|
|
|
|
|
2024-02-04 11:45:49 -08:00
|
|
|
fn step(state) {
|
|
|
|
radialbar_set_val("shield",
|
2024-02-03 18:35:32 -08:00
|
|
|
state.player_ship().get_shields()
|
|
|
|
/ state.player_ship().get_total_shields()
|
|
|
|
);
|
2024-02-04 11:45:49 -08:00
|
|
|
radialbar_set_val("hull",
|
2024-02-03 18:35:32 -08:00
|
|
|
state.player_ship().get_hull()
|
|
|
|
/ state.player_ship().get_total_hull()
|
|
|
|
);
|
2024-02-03 11:24:17 -08:00
|
|
|
}
|