56 lines
900 B
Plaintext
56 lines
900 B
Plaintext
fn init(state) {
|
|
|
|
conf_set_starfield(true);
|
|
conf_set_phys(true);
|
|
|
|
add_sprite(
|
|
"ring",
|
|
"ui::status",
|
|
Rect(
|
|
-5.0, -5.0, 100.0, 100.0,
|
|
Anchor::NorthEast,
|
|
Anchor::NorthEast
|
|
)
|
|
);
|
|
|
|
add_radialbar(
|
|
"shield", 2.5,
|
|
Color(0.3, 0.6, 0.8, 1.0),
|
|
Rect(
|
|
-9.5, -9.5, 91.0, 91.0,
|
|
Anchor::NorthEast,
|
|
Anchor::NorthEast
|
|
)
|
|
);
|
|
|
|
add_radialbar(
|
|
"hull", 2.5,
|
|
Color(0.8, 0.7, 0.5, 1.0),
|
|
Rect(
|
|
-13.5, -13.5, 83.0, 83.0,
|
|
Anchor::NorthEast,
|
|
Anchor::NorthEast
|
|
)
|
|
);
|
|
}
|
|
|
|
fn event(state, event) {
|
|
if type_of(event) == "PlayerShipStateEvent" {
|
|
if state.player_ship().is_landed() {
|
|
go_to_scene("landed");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
fn step(state) {
|
|
radialbar_set_val("shield",
|
|
state.player_ship().get_shields()
|
|
/ state.player_ship().get_total_shields()
|
|
);
|
|
radialbar_set_val("hull",
|
|
state.player_ship().get_hull()
|
|
/ state.player_ship().get_total_hull()
|
|
);
|
|
} |