-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmojo1.monkey
More file actions
executable file
·97 lines (55 loc) · 1.19 KB
/
mojo1.monkey
File metadata and controls
executable file
·97 lines (55 loc) · 1.19 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Import mojo
Class MyGame Extends App
Field tile:Image
Global currentScene:Int[][][]
Method OnCreate()
SetUpdateRate(60)
tile = LoadImage("tile.png")
currentScene = GenerateScene(9)
currentScene[0][0][0] = 1
End
Method OnUpdate()
End
Method OnRender()
Cls(255, 255, 255)
For Local i = 0 Until 10
DrawImage(tile, 50 + (tile.Width()-2) * i, 50)
End
For Local i = 0 Until 9
DrawImage(tile, 50 + tile.Width()/2-1 + (tile.Width()-2) * i, 58)
End
End
Method OnLoading()
End
Method OnSuspend()
End
Method OnResume()
End
End
Function DrawScene:Void(scene:Int[][][])
For Local i = 0 Until scene.Size()
For Local j = 0 To i
For Local k = 0 Until scene.Size()
' Render each tile in stack
If scene[i][j][k] == 0 ' Can not have floating tiles
Exit
End
End
End
End
End
Function GenerateScene:Int[][][](size:Int)
Local scene:Int[size][][]
For Local i = 0 Until size
scene[i] = New Int[size][]
For Local j = 0 Until size
scene[i][j] = New Int[size]
For Local k = 0 Until size
scene[i][j][k] = 0
End
End
End
End
Function Main()
New MyGame()
End