-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.agc
More file actions
161 lines (138 loc) · 3.31 KB
/
Copy pathmain.agc
File metadata and controls
161 lines (138 loc) · 3.31 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Project: test01
// Created: 2015-07-21
//#option_explicit
#include "init.agc"
#include "helpers.agc"
#include "playing.agc"
// set window properties
SetWindowTitle("test01")
SetWindowSize(640, 480, 0)
// set display properties
SetVirtualResolution(320, 240)
SetDefaultMagFilter(0)
SetOrientationAllowed(1, 1, 1, 1)
SetRawWritePath(GetReadPath())
#constant INIT 0
#constant TEST -1
#constant MENU 1
#constant INITGAME 2
#constant PLAY 3
image as integer = 0
image = LoadImage("spritesheet.png")
SetImageTransparentColor(image, 94, 129, 162)
debug$ as string = "Error : debug$"
debug$ = makeAtlasTxt()
dim img[899]
for i=0 to 899
img[i] = LoadSubImage(image,"img"+str(i))
SetImageTransparentColor(img[i], 94, 129, 162)
next i
var# as float = 0.6
temp as integer = 0
GLOBAL drawStuff as spriteGroup[]
GLOBAL mode = INIT
dim once[5]
GLOBAL loading = 1
do
Print(ScreenFPS())
select mode
//========================================
case INIT:
if (temp < 80)
print(GetWritePath())
print(GetReadPath())
print(debug$)
inc temp
else
mode = INITGAME
endif
if (once[0] = 0)
testo as spriteGroup
testo.name = "test"
testo.sprlist.insert(makeSprite(img[19], 100, 100, 1))
testo.sprlist.insert(makeSprite(img[1], 100, 150, 1))
remstart menu_bg as spriteGroup
for i=1 to GetScreenBoundsBottom() step GetImageHeight(bg_button)+1
for j=1 to GetScreenBoundsRight() step GetImageWidth(bg_button)+1
menu_bg.sprlist.insert(makeSprite(bg_button, j, i))
next j
next i
drawStuff.insert(testo)
drawStuff.insert(menu_bg)
remend
once[0] = 1
endif
loading = 0
checkMode()
endcase
//=========================================
case MENU:
print("This is the menu")
checkMode()
endcase
//=========================================
case INITGAME:
loadplay()
drawAll()
endcase
//=========================================
case PLAY:
print("Let's play")
endcase
//=========================================
case TEST:
remstart for i=0 to drawStuff.length
for j=0 to drawStuff[i].sprlist.length
SetSpritePosition(drawStuff[i].sprlist[j].ID,
drawStuff[i].sprlist[j].X, drawStuff[i].sprlist[j].Y)
SetSpriteVisible(drawStuff[i].sprlist[j].ID, 1)
next j
next i
remend
drawAll()
checkMode()
endcase
//=========================================
endselect
Sync()
loop
function drawAll()
for i=0 to drawStuff.length
for j=0 to drawStuff[i].sprlist.length
SetSpritePosition(drawStuff[i].sprlist[j].ID,
drawStuff[i].sprlist[j].X, drawStuff[i].sprlist[j].Y)
//SetSpriteVisible(drawStuff[i].sprlist[j].ID, 1)
next j
next i
endfunction
function checkMode()
if (GetRawKeyReleased(112))
mode = TEST
elseif (GetPointerReleased())
mode = PLAY
//DeleteAllSprites()
endif
endfunction
function makeSprite(imag, x, y, visible)
tempSprite as sprite
tempSprite.ID = createSprite(imag)
tempSprite.X = x
tempSprite.Y = y
SetSpritePosition(tempSprite.ID, x, y)
SetSpriteVisible(tempSprite.ID, visible)
endfunction tempSprite
// TYPES TYPES TYPES TYPES TYPES TYPES TYPES TYPES TYPES
TYPE spriteGroup
name as string
sprlist as sprite[]
pos as position
ENDTYPE
TYPE sprite
ID AS INTEGER
X AS INTEGER
Y AS INTEGER
ENDTYPE
TYPE position
X as INTEGER
Y as INTEGER
ENDTYPE