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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
-
|
|
|
|
|
|
|
!
-
|
|
|
|
|
-
|
!
|
-
|
!
|
|
-
|
!
|
-
|
!
!
-
|
-
|
!
|
-
|
!
!
-
|
|
-
|
!
|
-
|
!
!
-
|
|
!
-
|
|
!
-
|
|
|
-
|
|
!
-
|
|
|
!
-
|
|
!
|
#module
#deffunc m_ini
bksizex = 32 bksizey = 32 grv = 50 ChrSizeX = 16 ChrSizeY = 16
ChrCPosX = ChrSizeX / 2-1 ChrCPosY = ChrSizeY / 2-1
ChrCPosX2= ChrSizeX / 2 ChrCPosY2= ChrSizeY / 2
dim ChrPr, 4 return
#deffunc m_BBlock val
mref bblk, 48
return
#deffunc m_GetCellPosX100 val, int
mref cx, 16
mref ppx100, 1
cx = ppx100/100 / bksizex - (ppx100 ? (bksizex*100) <0)
return
#deffunc m_GetCellPosY100 val, int
mref cy, 16
mref ppy100, 1
cy = ppy100/100 / bksizey - (ppy100 ? (bksizey*100) <0)
return
#deffunc m_GetCellPosX val, int
mref cx, 16
mref ppx, 1
cx = ppx / bksizex - (ppx ? bksizex <0)
return
#deffunc m_GetCellPosY val, int
mref cy, 16
mref ppy, 1
cy = ppy / bksizey - (ppy ? bksizey <0)
return
#deffunc m_GetCellPosXY100 val, val, int, int
mref cx, 16
mref cy, 17
mref ppx100, 2
mref ppy100, 3
cx = ppx100/100 / bksizex - (ppx100 ? (bksizex*100) <0)
cy = ppy100/100 / bksizey - (ppy100 ? (bksizey*100) <0)
return
#deffunc m_GetChrPosBlk val, val
mref cpbkx, 16
mref cpbky, 17
m_GetCellPosXY100 cpbkx, cpbky, ChrPr.0, ChrPr.1
return
#deffunc m_ChrChk
mref statout, 64
statout = 0
if fyuka!0 : statout = 1 return
#deffunc m_PutChr
color 0,0,0
px = ChrPr.0/100 -vwposx
py = ChrPr.1/100
boxf px-ChrCPosX,py-ChrCPosY, px+ChrCPosX2,py+ChrCPosY2
return
#deffunc m_DrwCell
i=0
repeat 20 repeat 5 if bblk.cnt.i=1 {
color 192,192,255
iCellPosX = i*bksizex - vwposx iCellPoxY = cnt*bksizey boxf iCellPosX, iCellPoxY, iCellPosX + bksizex-1, iCellPoxY + bksizey-1
color 127,127,255
boxf iCellPosX+1, iCellPoxY+1, iCellPosX + bksizex-2, iCellPoxY + bksizey-2
color 0,0,0
}
loop
i++
loop
return
#deffunc mdb_PutChrPosBlk
m_GetChrPosBlk bx, by
color 255,127,127
boxf bx*bksizex-vwposx, by*bksizey, bx*bksizex-vwposx + bksizex-1, by*bksizey + bksizey-1
return
#deffunc m_ViewPos int
mref p1, 0
vwposx = p1
return
#deffunc m_ChrPos val, val
mref vx100, 16 mref vy100, 17
px100 = ChrPr.0
py100 = ChrPr.1
vy100f = vy100 + grv px100f = px100 + vx100
py100f = py100 + vy100f
pxf = px100f/100 pyf = py100f/100
fkabe = 0
if vx100!0 {
m_GetCellPosY100 bkyt0, py100-(ChrCPosY*100) m_GetCellPosY100 bkyd0, py100+(ChrCPosY2*100) m_GetCellPosX bkxr1, pxf+ChrCPosX2 m_GetCellPosX bkxl1, pxf-ChrCPosX if (bkyd0>=0)&(bkyd0<5) & (bkxr1>=0)&(bkxr1<100) {
if bblk.bkyd0.bkxr1!0 : fkabe = 1 }
if (bkyd0>=0)&(bkyd0<5) & (bkxl1>=0)&(bkxl1<100) {
if bblk.bkyd0.bkxl1!0 : fkabe = 1
}
if (bkyt0>=0)&(bkyt0<5) & (bkxr1>=0)&(bkxr1<100) {
if bblk.bkyt0.bkxr1!0 : fkabe = 1
}
if (bkyt0>=0)&(bkyt0<5) & (bkxl1>=0)&(bkxl1<100) {
if bblk.bkyt0.bkxl1!0 : fkabe = 1
}
}
m_GetCellPosX100 bkxl0, px100-(ChrCPosX*100) m_GetCellPosX100 bkxr0, px100+(ChrCPosX2*100) m_GetCellPosY bkyd1, pyf+ChrCPosY2
fyuka = 0
if vy100f>0 {
if (bkyd1>=0)&(bkyd1<5) & (bkxl0>=0)&(bkxl0<100) {
if bblk.bkyd1.bkxl0!0 : fyuka = 1 }
if (bkyd1>=0)&(bkyd1<5) & (bkxr0>=0)&(bkxr0<100) {
if bblk.bkyd1.bkxr0!0 : fyuka = 1
}
}
ften = 0
if vy100f<0 {
m_GetCellPosY bkyt1, pyf-ChrCPosY if (bkyt1>=0)&(bkyt1<5) & (bkxl0>=0)&(bkxl0<100) {
if bblk.bkyt1.bkxl0!0 : ften = 1 }
if (bkyt1>=0)&(bkyt1<5) & (bkxr0>=0)&(bkxr0<100) {
if bblk.bkyt1.bkxr0!0 : ften = 1
}
}
if fkabe!0 {
vx100 = -1*vx100/2
}
if ften!0 {
vy100 = -1*vy100
}
if fyuka!0 {
if vy100>0 : vy100 = 0 py100 = bkyd1*bksizey *100-1 -(ChrCPosY2*100) -(bkyd1<=0 *100)
} else {
vy100 = vy100 + grv }
if fyuka!0 {
if 0 > vx100 : vx100=vx100+30 : if 0 < vx100 : vx100=0
if 0 < vx100 : vx100=vx100-30 : if 0 > vx100 : vx100=0
}
px100 = px100 + vx100
py100 = py100 + vy100
ChrPr.0 = px100
ChrPr.1 = py100
m_ViewPos ChrPr.0/100 - (winx/2) m_PutChr
return
#global
m_ini
#define MAXSPEED 1000
dim bgimg, 5,100
bgimg.0.0 = 0, 0, 1, 0, 1
bgimg.0.1 = 0, 0, 0, 1, 1
bgimg.0.2 = 0, 0, 0, 0, 1
bgimg.0.3 = 0, 1, 0, 0, 1
bgimg.0.4 = 0, 1, 0, 0, 1
bgimg.0.5 = 1, 0, 1, 0, 1
bgimg.0.6 = 0, 0, 0, 0, 1
bgimg.0.7 = 0, 0, 0, 0, 1
bgimg.0.8 = 0, 0, 0, 0, 0
bgimg.0.9 = 0, 0, 0, 0, 1
bgimg.0.10= 1, 1, 0, 0, 1
bgimg.0.11= 0, 0, 0, 0, 1
bgimg.0.12= 0, 0, 0, 0, 1
bgimg.0.13= 0, 0, 0, 0, 1
bgimg.0.14= 0, 0, 0, 1, 1
bgimg.0.15= 0, 0, 0, 0, 1
bgimg.0.16= 0, 0, 0, 1, 0
bgimg.0.17= 0, 0, 0, 0, 0
bgimg.0.18= 0, 0, 0, 0, 1
bgimg.0.19= 0, 0, 0, 1, 1
m_BBlock bgimg
*main
redraw 0
color 255, 255, 255 : boxf : color 0, 0, 0 : pos 0,0
stick key, 1+4
if key&1 : vx-=50 if key&4 : vx+=50
if MAXSPEED<vx : vx = MAXSPEED if -MAXSPEED>vx : vx = -MAXSPEED
if key&2 : {
m_ChrChk
if stat=1 : vy=-700 }
if key&128 : goto *owari
m_DrwCell mdb_PutChrPosBlk m_ChrPos vx, vy
redraw 1
await 20
goto *main
*owari
end
|