-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_program.tri
More file actions
51 lines (46 loc) · 766 Bytes
/
test_program.tri
File metadata and controls
51 lines (46 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var i: int = 0;
var x: int = 0;
var y: int = 0;
var a: int[4] = new;
fun draw_block(x: int, y: int, color: int)
{
var i: int = 0;
while i < 4 {
draw_at(x + i, y, color);
i = i + 1;
}
}
fun start()
{
draw_at(x, y, 0xFFD700);
prints("start\n");
}
fun update()
{
draw_block(x, y, 0);
if left_pressed?() {
if x > 0
{
x = (x - 1);
} else {}
} else {}
if right_pressed?() {
if x < 6
{
x = (x + 1);
} else {}
} else {}
if up_pressed?() {
if y > 0
{
y = (y - 1);
} else {}
} else {}
if down_pressed?() {
if y < 17
{
y = (y + 1);
} else {}
} else {}
draw_block(x, y, 0xFFD700);
}