Skip to content

Commit e80ec06

Browse files
committed
improve control manager demo
1 parent 20bdb91 commit e80ec06

File tree

88 files changed

+237
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+237
-1
lines changed

current-scripts/Demos/useful-scripts/objects/obj_control_manager_demo/Create_0.gml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ control_labels[CONTROLS.JUMP] = "Jump";
77
control_labels[CONTROLS.INTERACT] = "Interact";
88
control_labels[CONTROLS.ITEM] = "Item";
99

10+
control_prompts[CONTROLS.UP] = [0, 8, 16, 24];
11+
control_prompts[CONTROLS.DOWN] = [1, 9, 17, 25];
12+
control_prompts[CONTROLS.LEFT] = [2, 10, 18, 26];
13+
control_prompts[CONTROLS.RIGHT] = [3, 11, 19, 27];
14+
control_prompts[CONTROLS.SHOOT] = [4, 12, 22];
15+
control_prompts[CONTROLS.JUMP] = [5, 13, 20];
16+
control_prompts[CONTROLS.INTERACT] = [6, 14, 21];
17+
control_prompts[CONTROLS.ITEM] = [7, 15, 23];
18+
1019
num_controls = CONTROLS.MAX;
1120

1221
control_manager = instance_create_layer(0, 0, layer, obj_control_manager);

current-scripts/Demos/useful-scripts/objects/obj_control_manager_demo/Draw_0.gml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
draw_set_font(fnt_title);
2+
draw_set_colour(c_white);
23
draw_text(16, 16, "Control Manager Demo");
34

45
for (var i=0; i<num_controls; i++) {
5-
draw_text(8, i*32 + 96, string(control_labels[i]) + ": " + string(my_player.get_control_state(i, CONTROL_STATE.HELD)));
6+
var _pressed = my_player.get_control_state(i, CONTROL_STATE.HELD);
7+
var _text_colour = _pressed ? c_lime : c_white;
8+
9+
draw_set_colour(_text_colour);
10+
draw_text(8, i*52 + 96, string(control_labels[i]));
11+
var _num_prompts = array_length(control_prompts[i]);
12+
13+
for (var j=0; j<_num_prompts; j++) {
14+
draw_sprite(spr_prompts, control_prompts[i][j], 160 + j*52, i*52 + 104);
15+
}
616
}
717

818
// for (i=0; i<8; i++) {
4.35 KB
2.07 KB
1.89 KB
2.18 KB
4.39 KB
1.77 KB
4.34 KB
2.18 KB

0 commit comments

Comments
 (0)