### Author Topic: Better way to moving 'sprites'  (Read 2740 times)

0 Members and 1 Guest are viewing this topic.

#### RobinGravel

• Newbie
• Posts: 30
##### Better way to moving 'sprites'
« on: August 07, 2021, 10:22:07 am »
I always do this when programming in QB.

I wonder if there is a way to improve it.

Code: QB64: [Select]
1. 'Frpg3d
2. X1 = 0: Y1 = 0: X2 = 7: Y2 = 7
3. m = 4 + Int(((PMap(X2!, 0) - PMap(X1!, 0) + 1) * (1) + 7) / 8) * 4 * (PMap(Y2!, 1) - PMap(Y1!, 1) + 1)
4. X1 = 0: Y1 = 0: X2 = 15: Y2 = 15
5. m2 = 4 + Int(((PMap(X2!, 0) - PMap(X1!, 0) + 1) * (1) + 7) / 8) * 4 * (PMap(Y2!, 1) - PMap(Y1!, 1) + 1)
6. X1 = 0: Y1 = 0: X2 = 15: Y2 = 31
7. m4 = 4 + Int(((PMap(X2!, 0) - PMap(X1!, 0) + 1) * (1) + 7) / 8) * 4 * (PMap(Y2!, 1) - PMap(Y1!, 1) + 1)
8.
9. Dim t1%(m), t2%(m), t3%(m), pl1%(m2), pl2%(m2), pl3%(m2), pl4%(m2), pl5%(m2)
10. Dim pl6%(m2), pl7%(m2), pl8%(m2), pl9%(m2), pl10%(m2), mr01%(m2), mr02%(m2)
11. Dim rd1%(m4), rd2%(m4), vd%(m4)
12. 'tile 1
13. x = 0: y = 0
14. For z1 = 1 To 8
15.     For z2 = 1 To 8
17.         If r = 0 Then PSet (x, y), 8
18.         If r = 1 Then PSet (x, y), 7
19.         If r = 2 Then PSet (x, y), 15
20.         x = x + 1
21.     Next z2
22.     x = 0: y = y + 1
23. Next z1
24. Get (0, 0)-(7, 7), t1%()
25.
26. 'tile 2
27. x = 0: y = 0
28. For z1 = 1 To 8
29.     For z2 = 1 To 8
31.         If r = 0 Then PSet (x, y), 0
32.         If r = 1 Then PSet (x, y), 8
33.         If r = 2 Then PSet (x, y), 7
34.         If r = 3 Then PSet (x, y), 15
35.         x = x + 1
36.     Next z2
37.     x = 0: y = y + 1
38. Next z1
39. Get (0, 0)-(7, 7), t2%()
40.
41. 'tile 3
42. x = 0: y = 0
43. For z1 = 1 To 8
44.     For z2 = 1 To 8
46.         If r = 0 Then PSet (x, y), 0
47.         If r = 1 Then PSet (x, y), 7
48.         If r = 2 Then PSet (x, y), 8
49.         If r = 3 Then PSet (x, y), 15
50.         x = x + 1
51.     Next z2
52.     x = 0: y = y + 1
53. Next z1
54. Get (0, 0)-(7, 7), t3%()
55. 'plancher 1
56. x = 0: y = 0
57. For z1 = 1 To 16
58.     For z2 = 1 To 16
60.         If r = 0 Then PSet (x, y), 6
61.         If r = 1 Then PSet (x, y), 4
62.         x = x + 1
63.     Next z2
64.     x = 0: y = y + 1
65. Next z1
66. Get (0, 0)-(15, 15), pl1%()
67. 'plancher 2
68. x = 0: y = 0
69. For z1 = 1 To 16
70.     For z2 = 1 To 16
72.         If r = 0 Then PSet (x, y), 6
73.         If r = 1 Then PSet (x, y), 4
74.         If r = 2 Then PSet (x, y), 8
75.         x = x + 1
76.     Next z2
77.     x = 0: y = y + 1
78. Next z1
79. Get (0, 0)-(15, 15), pl2%()
80. 'plancher 3
81. x = 0: y = 0
82. For z1 = 1 To 16
83.     For z2 = 1 To 16
85.         If r = 0 Then PSet (x, y), 8
86.         If r = 1 Then PSet (x, y), 0
87.         x = x + 1
88.     Next z2
89.     x = 0: y = y + 1
90. Next z1
91. Get (0, 0)-(15, 15), pl3%()
92. 'plancher 4
93. x = 0: y = 0
94. For z1 = 1 To 16
95.     For z2 = 1 To 16
97.         If r = 0 Then PSet (x, y), 6
98.         If r = 1 Then PSet (x, y), 4
99.         If r = 2 Then PSet (x, y), 8
100.         x = x + 1
101.     Next z2
102.     x = 0: y = y + 1
103. Next z1
104. Get (0, 0)-(15, 15), pl4%()
105. 'plancher 5
106. x = 0: y = 0
107. For z1 = 1 To 16
108.     For z2 = 1 To 16
110.         If r = 0 Then PSet (x, y), 6
111.         If r = 1 Then PSet (x, y), 4
112.         If r = 2 Then PSet (x, y), 8
113.         x = x + 1
114.     Next z2
115.     x = 0: y = y + 1
116. Next z1
117. Get (0, 0)-(15, 15), pl5%()
118. 'plancher 6
119. x = 0: y = 0
120. For z1 = 1 To 16
121.     For z2 = 1 To 16
123.         If r = 0 Then PSet (x, y), 6
124.         If r = 1 Then PSet (x, y), 4
125.         If r = 2 Then PSet (x, y), 8
126.         x = x + 1
127.     Next z2
128.     x = 0: y = y + 1
129. Next z1
130. Get (0, 0)-(15, 15), pl6%()
131. 'plancher 7
132. x = 0: y = 0
133. For z1 = 1 To 16
134.     For z2 = 1 To 16
136.         If r = 0 Then PSet (x, y), 6
137.         If r = 1 Then PSet (x, y), 4
138.         If r = 2 Then PSet (x, y), 8
139.         x = x + 1
140.     Next z2
141.     x = 0: y = y + 1
142. Next z1
143. Get (0, 0)-(15, 15), pl7%()
144. 'plancher 8
145. x = 0: y = 0
146. For z1 = 1 To 16
147.     For z2 = 1 To 16
149.         If r = 0 Then PSet (x, y), 6
150.         If r = 1 Then PSet (x, y), 4
151.         If r = 2 Then PSet (x, y), 8
152.         x = x + 1
153.     Next z2
154.     x = 0: y = y + 1
155. Next z1
156. Get (0, 0)-(15, 15), pl8%()
157.
158. 'plancher 9
159. x = 0: y = 0
160. For z1 = 1 To 16
161.     For z2 = 1 To 16
163.         If r = 0 Then PSet (x, y), 6
164.         If r = 1 Then PSet (x, y), 4
165.         If r = 2 Then PSet (x, y), 8
166.         x = x + 1
167.     Next z2
168.     x = 0: y = y + 1
169. Next z1
170. Get (0, 0)-(15, 15), pl9%()
171. 'plancher 10
172. x = 0: y = 0
173. For z1 = 1 To 16
174.     For z2 = 1 To 16
176.         If r = 0 Then PSet (x, y), 6
177.         If r = 1 Then PSet (x, y), 4
178.         If r = 2 Then PSet (x, y), 8
179.         x = x + 1
180.     Next z2
181.     x = 0: y = y + 1
182. Next z1
183. Get (0, 0)-(15, 15), pl10%()
184. 'mur 1
185. x = 0: y = 0
186. For z1 = 1 To 16
187.     For z2 = 1 To 16
189.         If r = 0 Then PSet (x, y), 14
190.         If r = 1 Then PSet (x, y), 8
191.         x = x + 1
192.     Next z2
193.     x = 0: y = y + 1
194. Next z1
195. Get (0, 0)-(15, 15), mr01%()
196. 'mur 2
197. x = 0: y = 0
198. For z1 = 1 To 16
199.     For z2 = 1 To 16
201.         If r = 0 Then PSet (x, y), 12
202.         If r = 1 Then PSet (x, y), 8
203.         x = x + 1
204.     Next z2
205.     x = 0: y = y + 1
206. Next z1
207. Get (0, 0)-(15, 15), mr02%()
208. 'Rodan
209. x = 0: y = 0
210. For z1 = 1 To 32
211.     For z2 = 1 To 16
213.         If r = 0 Then PSet (x, y), 0
214.         If r = 1 Then PSet (x, y), 10
215.         If r = 2 Then PSet (x, y), 12
216.         If r = 3 Then PSet (x, y), 15
217.         If r = 4 Then PSet (x, y), 4
218.         If r = 5 Then PSet (x, y), 9
219.         If r = 6 Then PSet (x, y), 8
220.         If r = 7 Then PSet (x, y), 1
221.         x = x + 1
222.     Next z2
223.     x = 0: y = y + 1
224. Next z1
225. Get (0, 0)-(15, 31), rd1%()
226. 'Rodan
227. Restore Rodan
228. x = 0: y = 0
229. For z1 = 1 To 32
230.     For z2 = 1 To 16
232.         If r = 0 Then PSet (x, y), 0 Else PSet (x, y), 15
233.         x = x + 1
234.     Next z2
235.     x = 0: y = y + 1
236. Next z1
237. Get (0, 0)-(15, 31), rd2%()
238.
239. x = 0: y = 0
240. For z1% = 1 To 7
241.     For z2% = 1 To 8
243.         If r\$ = "0" Then Put (x, y), pl1%(), PSet
244.         If r\$ = "1" Then Put (x, y), pl2%(), PSet
245.         If r\$ = "2" Then Put (x, y), pl3%(), PSet
246.         If r\$ = "3" Then Put (x, y), pl4%(), PSet
247.         If r\$ = "4" Then Put (x, y), pl5%(), PSet
248.         If r\$ = "5" Then Put (x, y), pl6%(), PSet
249.         If r\$ = "6" Then Put (x, y), pl7%(), PSet
250.         If r\$ = "7" Then Put (x, y), pl8%(), PSet
251.         If r\$ = "8" Then Put (x, y), pl9%(), PSet
252.         If r\$ = "9" Then Put (x, y), pl10%(), PSet
253.         If r\$ = "A" Then Put (x, y), mr01%(), PSet
254.         If r\$ = "B" Then Put (x, y), mr02%(), PSet
255.         x = x + 16
256.     Next z2%
257.     x = 0: y = y + 16
258. Next z1%
259. rx = 60: ry = 32
260. For z = 1 To 5
261.     For rx = 60 To 100 Step 8
262.         Get (rx, ry)-Step(15, 31), vd%()
263.         Put (rx, ry), rd2%(), Or: Put (rx, ry), rd2%(), Xor: Put (rx, ry), rd1%(), Xor
264.         _Delay .2
265.         Put (rx, ry), vd%(), PSet
266.     For rx = 100 To 60 Step -8
267.         Get (rx, ry)-Step(15, 31), vd%()
268.         Put (rx, ry), rd2%(), Or: Put (rx, ry), rd2%(), Xor: Put (rx, ry), rd1%(), Xor
269.         _Delay .2
270.         Put (rx, ry), vd%(), PSet
271.
272. 'GoTo boucle
273. 'Locate 14, 2: Print rx
274.
275. '8x8
276. Data 0,0,0,0,0,0,0,0
277. Data 0,0,0,0,0,0,0,0
278. Data 0,0,0,0,0,0,0,0
279. Data 0,0,0,0,0,0,0,0
280. Data 0,0,0,0,0,0,0,0
281. Data 0,0,0,0,0,0,0,0
282. Data 0,0,0,0,0,0,0,0
283. Data 0,0,0,0,0,0,0,0
284. '16x16
285. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
286. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
287. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
288. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
289. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
290. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
291. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
292. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
293. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
294. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
295. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
296. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
297. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
298. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
299. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
300. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
301. '16x32
302. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
303. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
304. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
305. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
306. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
307. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
308. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
309. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
310. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
311. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
312. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
313. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
314. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
315. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
316. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
317. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
318. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
319. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
320. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
321. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
322. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
323. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
324. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
325. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
326. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
327. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
328. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
329. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
330. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
331. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
332. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
333. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
334.
335.
336. ici:
337.
338. 'tile 1
339. Data 0,0,0,0,0,0,0,0
340. Data 0,2,2,2,2,2,2,0
341. Data 0,2,1,2,2,1,2,0
342. Data 0,2,2,2,2,2,2,0
343. Data 0,2,2,2,2,2,2,0
344. Data 0,2,1,2,2,1,2,0
345. Data 0,2,2,2,2,2,2,0
346. Data 0,0,0,0,0,0,0,0
347. ' tile 2
348. Data 0,0,0,0,0,0,0,0
349. Data 1,1,1,1,1,1,1,1
350. Data 2,2,2,2,2,2,2,2
351. Data 3,3,3,3,3,3,3,3
352. Data 3,3,3,3,3,3,3,3
353. Data 2,2,2,2,2,2,2,2
354. Data 1,1,1,1,1,1,1,1
355. Data 0,0,0,0,0,0,0,0
356. ' tile 3
357. Data 0,2,1,3,3,1,2,0
358. Data 0,2,1,3,3,1,2,0
359. Data 0,2,1,3,3,1,2,0
360. Data 0,2,1,3,3,1,2,0
361. Data 0,2,1,3,3,1,2,0
362. Data 0,2,1,3,3,1,2,0
363. Data 0,2,1,3,3,1,2,0
364. Data 0,2,1,3,3,1,2,0
365. 'Plancher 1
366. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
367. Data 0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0
368. Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
369. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
370. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
371. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
372. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
373. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
374. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
375. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
376. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
377. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
378. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
379. Data 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
380. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
381. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
382. 'Plancher 2
383. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
384. Data 0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0
385. Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
386. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
387. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
388. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
389. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
390. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
391. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
392. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
393. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
394. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
395. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
396. Data 0,2,2,2,2,1,0,2,2,2,0,0,2,2,2,2
397. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
398. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
399. 'Plancher 3
400. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
401. Data 0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0
402. Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
403. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
404. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
405. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
406. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
407. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
408. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
409. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
410. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
411. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
412. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
413. Data 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
414. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
415. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
416. 'Plancher 4
417. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
418. Data 2,2,2,0,2,2,2,2,2,0,0,2,2,2,2,2
419. Data 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0
420. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
421. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
422. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0
423. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
424. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0
425. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
426. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
427. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
428. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
429. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
430. Data 0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
431. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
432. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
433. 'Plancher 5
434. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
435. Data 0,1,0,0,0,0,0,0,0,0,0,0,1,0,2,2
436. Data 0,0,0,0,0,0,1,0,0,0,0,0,0,2,2,2
437. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
438. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
439. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2
440. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,2
441. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,2,2,2
442. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
443. Data 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
444. Data 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
445. Data 1,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
446. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
447. Data 0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,2
448. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
449. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
450. 'Plancher 6
451. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
452. Data 2,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0
453. Data 2,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0
454. Data 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0
455. Data 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0
456. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0
457. Data 2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0
458. Data 2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0
459. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
460. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
461. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
462. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
463. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
464. Data 2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0
465. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0
466. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
467. 'Plancher 7
468. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
469. Data 0,1,0,0,0,0,0,0,0,0,0,0,1,0,2,2
470. Data 0,0,0,0,0,0,1,0,0,0,0,0,0,2,2,2
471. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
472. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
473. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2
474. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,2
475. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,2,2,2
476. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
477. Data 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
478. Data 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
479. Data 1,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
480. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
481. Data 0,0,0,2,2,2,2,0,0,2,2,0,2,2,2,2
482. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
483. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
484.
485. 'Plancher 8
486. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
487. Data 2,2,0,0,0,0,0,0,0,0,0,0,1,0,0,0
488. Data 2,2,2,0,0,0,1,0,0,0,0,0,0,0,0,0
489. Data 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0
490. Data 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0
491. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0
492. Data 2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0
493. Data 2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0
494. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
495. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
496. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
497. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
498. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
499. Data 2,2,2,0,2,2,2,0,0,2,2,2,2,2,0,0
500. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
501. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
502. 'Plancher 9
503. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
504. Data 2,2,2,2,0,0,2,2,2,2,2,2,2,2,2,2
505. Data 0,0,0,0,0,0,1,0,2,2,0,0,2,2,2,2
506. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
507. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
508. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,2
509. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,0,2,2
510. Data 0,0,0,0,0,0,0,0,1,0,0,0,0,2,2,2
511. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
512. Data 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
513. Data 0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
514. Data 1,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2
515. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2
516. Data 0,0,0,0,0,1,0,0,0,0,0,0,0,0,2,2
517. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
518. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2
519. 'Plancher 10
520. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
521. Data 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
522. Data 2,2,2,2,2,0,2,2,2,2,0,0,2,2,2,0
523. Data 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0
524. Data 2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0
525. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,1,0,0
526. Data 2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0
527. Data 2,2,0,0,0,0,0,0,1,0,0,0,0,0,0,0
528. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
529. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
530. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
531. Data 2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
532. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
533. Data 2,2,0,0,0,1,0,0,0,0,0,0,0,0,0,0
534. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,1,0
535. Data 2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
536. 'mur 1
537. Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
538. Data 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
539. Data 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
540. Data 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
541. Data 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
542. Data 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
543. Data 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0
544. Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
545. Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
546. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
547. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
548. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
549. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
550. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
551. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
552. Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
553. 'mur 2
554. 'DATA 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
555.
556. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
557. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
558. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
559. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
560. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
561. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
562. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
563. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
564. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
565. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
566. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
567. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
568. Data 1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1
569. Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
570. Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
571. Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
572.
573.
574. Rodan:
575. 'Rodan
576. Data 0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0
577. Data 0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0
578. Data 0,0,0,0,1,1,1,1,2,1,1,0,0,0,0,0
579. Data 0,0,0,0,1,2,2,2,2,2,1,0,0,0,0,0
580. Data 0,0,0,0,2,2,3,2,3,2,2,0,0,0,0,0
581. Data 0,0,0,0,2,2,2,2,2,2,2,0,0,0,0,0
582. Data 0,0,0,0,1,2,2,4,2,2,1,0,0,0,0,0
583. Data 0,0,0,0,1,2,2,2,2,2,1,0,0,0,0,0
584. Data 0,0,0,0,0,2,4,4,4,2,0,0,0,0,0,0
585. Data 0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0
586. Data 0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0
587. Data 0,0,0,0,7,5,5,5,5,5,7,0,0,0,0,0
588. Data 0,0,0,0,7,5,5,5,5,5,7,0,0,0,0,0
589. Data 0,0,0,0,7,5,5,5,5,5,7,0,0,0,0,0
590. Data 0,0,0,0,7,5,5,5,5,5,7,0,0,0,0,0
591. Data 0,0,0,0,7,5,5,5,5,5,7,0,0,0,0,0
592. Data 0,0,0,0,7,5,5,5,5,5,7,0,0,0,0,0
593. Data 0,0,0,0,3,5,5,5,5,5,3,0,0,0,0,0
594. Data 0,0,0,0,2,6,6,6,6,6,2,0,0,0,0,0
595. Data 0,0,0,0,2,7,7,7,7,7,2,0,0,0,0,0
596. Data 0,0,0,0,2,7,7,7,7,7,2,0,0,0,0,0
597. Data 0,0,0,0,0,7,7,7,7,7,0,0,0,0,0,0
598. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
599. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
600. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
601. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
602. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
603. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
604. Data 0,0,0,0,0,7,7,0,7,7,0,0,0,0,0,0
605. Data 0,0,0,0,0,3,3,0,3,3,0,0,0,0,0,0
606. Data 0,0,0,0,0,3,3,0,3,3,0,0,0,0,0,0
607. Data 0,0,0,0,0,6,6,0,6,6,0,0,0,0,0,0
608.
609. Monde:
610.
611. Data B,B,B,B,4,2,5,B
612. Data A,A,A,A,4,2,5,A
613. Data A,A,z,A,4,2,5,A
614. Data A,A,z,A,4,2,5,A
615. Data 1,6,2,7,6,2,7,1
616. Data 2,2,2,2,2,2,2,2
617. Data 3,3,3,3,8,2,9,3
618.
« Last Edit: August 07, 2021, 10:23:53 am by RobinGravel »

#### bplus

• Global Moderator
• Forum Resident
• Posts: 8053
• b = b + ...
##### Re: Better way to moving 'sprites'
« Reply #1 on: August 07, 2021, 11:41:14 am »
Quote
I wonder if there is a way to improve it.

Yes! many ways, Cobalt, Unseen many others have developed whole systems to tiling, building backgrounds and sprites....

It probably starts by making tile images and then building images for more images so can move sprite as one image.
« Last Edit: August 07, 2021, 11:43:06 am by bplus »

#### bplus

• Global Moderator
• Forum Resident
• Posts: 8053
• b = b + ...
##### Re: Better way to moving 'sprites'
« Reply #2 on: August 07, 2021, 11:57:03 am »
Can you make a routine to draw your sprite at any x,y? Usually x,y is top, left corner of image but could be it's middle too. With that, use arrow keys or mouse to say the x, y position of sprite.

#### RobinGravel

• Newbie
• Posts: 30
##### Re: Better way to moving 'sprites'
« Reply #3 on: August 07, 2021, 12:19:01 pm »
Doesn't sprites always draw from left?

Is there other alternatives to draw sprites?

#### loudar

• Newbie
• Posts: 73
• improve it bit by bit.
##### Re: Better way to moving 'sprites'
« Reply #4 on: August 07, 2021, 12:34:26 pm »
There are many ways in which you could "improve" this, though that's always subjective of course.

For me, I like having my sprites as images within a folder, then load them and be able to just play with them how I want. That removes code from the program and generalizes the drawing part a lot.
I wrote some functions in QB64 that can do that in my latest Gamejam participation: https://github.com/loudar/Gamejam-2021-07-24

There are many options how you can tweak this, it totally depends on your coding style and your end goal ;D
Check out what I do besides coding: http://loudar.myportfolio.com/

#### bplus

• Global Moderator
• Forum Resident
• Posts: 8053
• b = b + ...
##### Re: Better way to moving 'sprites'
« Reply #5 on: August 07, 2021, 02:36:51 pm »
Here is simple code for a bat sprite to follow mouse position:
Code: QB64: [Select]
1. '_title "Moving Bat Sprites" 'b+ 2021-08-07
2. Screen _NewImage(800, 600, 32)
3. _ScreenMove 300, 50
4. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
6. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
8. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
9. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
10. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
11. Data 0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0
12. Data 1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0
13. Data 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0
14. Data 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0
15. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
16. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
17. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
18. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
19. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
20.
21.
22. Dim Shared sprt(15, 15) 'sprite 1 bat wings up
23.
24. For y = 0 To 15 '5* 16 = 80
25.     For x = 0 To 15
26.         Read sprt(x, y)
27.
28.     Cls , _RGB32(0, 0, 128)
29.     While _MouseInput: Wend 'polls mouse
30.     drawBat _MouseX - 40, _MouseY - 40 ' -40 because want to draw the bat around the mouse, sprite is 16 * 5 = 80
31.     _Limit 20
32.
33. Sub drawBat (bx, by)
34.     sz = 5 ' scale the pixels into little 5x5 boxes for larger tile
35.     For y = 0 To 15
36.         For x = 0 To 15
37.             If sprt(x, y) Then Line (x * sz + bx, y * sz + by)-Step(sz, sz), _RGB32(0, 0, 0), BF
38.
39.
« Last Edit: August 07, 2021, 02:37:57 pm by bplus »

#### RobinGravel

• Newbie
• Posts: 30
##### Re: Better way to moving 'sprites'
« Reply #6 on: August 07, 2021, 03:03:44 pm »
Thanks.

It's a good start.

I'll take a look at it.
« Last Edit: August 07, 2021, 03:05:38 pm by RobinGravel »

#### bplus

• Global Moderator
• Forum Resident
• Posts: 8053
• b = b + ...
##### Re: Better way to moving 'sprites'
« Reply #7 on: August 07, 2021, 04:47:21 pm »
Added 2nd sprite for some animation fun:
Code: QB64: [Select]
1. _Title "Moving Bat Sprites, move mousewheel to increase or decrease bat size " 'b+ 2021-08-07
2. Screen _NewImage(800, 600, 32)
3. _ScreenMove 300, 50
4. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
6. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
8. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
9. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
10. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
11. Data 0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0
12. Data 1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0
13. Data 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0
14. Data 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0
15. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
16. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
17. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
18. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
19. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
20.
21. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
22. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
23. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
24. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
25. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
26. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
27. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
28. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
29. Data 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
30. Data 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0
31. Data 0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,0
32. Data 0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0
33. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0
34. Data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
35. Data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
36. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
37.
38. Dim Shared sprt(15, 15) 'sprt() bat wings up
39. Dim Shared flap, sz
40.
41. For y = 0 To 15 '5* 16 = 80
42.     For x = 0 To 15
43.         Read sprt(x, y)
44.
45. Dim Shared sprt2(15, 15) ' sprt2() bat wings down
46. For y = 0 To 15
47.     For x = 0 To 15
48.         Read sprt2(x, y)
49.     loopcount = loopcount + 1
50.     If loopcount = 10 Then loopcount = 0: flap = 1 - flap
51.     Cls , _RGB32(0, 0, 128)
52.
53.     ' debug
54.     'Print loopcount, flap
55.
56.         sz = sz + _MouseWheel
57.         If sz < 1 Then sz = 1
58.         If sz > 20 Then sz = 20
59.     Wend 'polls mouse
60.     drawBat _MouseX - sz * 8, _MouseY - sz * 8 ' -40 because want to draw the bat around the mouse, sprite is 16 * 5 = 80
61.     _Limit 20
62.
63. Sub drawBat (bx, by)
64.     ' shared now sz = 5 ' scale the pixels into little 5x5 boxes for larger tile
65.     For y = 0 To 15
66.         For x = 0 To 15
67.             If flap Then
68.                 If sprt(x, y) Then Line (x * sz + bx, y * sz + by)-Step(sz, sz), _RGB32(0, 0, 0), BF
69.                 If sprt2(x, y) Then Line (x * sz + bx, y * sz + by)-Step(sz, sz), _RGB32(0, 0, 0), BF
70.
71.

#### SMcNeill

• QB64 Developer
• Forum Resident
• Posts: 3972
##### Re: Better way to moving 'sprites'
« Reply #8 on: August 07, 2021, 05:44:41 pm »
Easiest way I know to do this is to just make your sprites sprites and then putimage them to the screen.

Code: QB64: [Select]
1. _Title "Moving Bat Sprites, move mousewheel to increase or decrease bat size " 'b+ 2021-08-07
2. Screen _NewImage(800, 600, 32)
3. _ScreenMove 300, 50
4. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
5. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
6. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
7. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
8. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
9. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
10. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
11. Data 0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0
12. Data 1,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0
13. Data 0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0
14. Data 0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0
15. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
16. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
17. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
18. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
19. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
20.
21. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
22. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
23. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
24. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
25. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
26. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
27. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
28. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
29. Data 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
30. Data 0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0
31. Data 0,0,0,0,1,0,1,1,1,0,0,1,0,0,0,0
32. Data 0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0
33. Data 0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0
34. Data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
35. Data 0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0
36. Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
37.
38. Dim As Long bat(1)
39. bat(0) = _NewImage(16, 16, 32): bat(1) = _NewImage(16, 16, 32)
40.
41. For z = 0 To 1
42.     If z Then _Dest bat(1) Else _Dest bat(0)
43.     For y = 0 To 15 '5* 16 = 80
44.         For x = 0 To 15
46.             If p Then PSet (x, y), _RGB32(255, 255, 255)
47.
48.     loopcount = loopcount + 1
49.     If loopcount = 10 Then loopcount = 0: flap = Not flap
50.     Cls , _RGB32(0, 0, 128)
51.
52.         sz = sz + .1 * -_MouseWheel
53.     Wend 'polls mouse
54.     If sz < 1 Then sz = 1
55.     If sz > 10 Then sz = 10
56.     _PutImage (_MouseX, _MouseY)-Step(16 * sz, 16 * sz), bat(flap)
57.     _Limit 20
58.

As you can see here, I've simply made two 16x16 sorites and then used READ to read the data and create my bat images, which I then simply use PUTIMAGE to display to the screen.  It doesn't get any easier than that.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

#### bplus

• Global Moderator
• Forum Resident
• Posts: 8053
• b = b + ...
##### Re: Better way to moving 'sprites'
« Reply #9 on: August 07, 2021, 07:24:17 pm »
Yeah that would be next step, bit of a learning curve though (with _NewImage with _Dest and _PutImage)

Sorite?, not Soarite? ;-))
« Last Edit: August 07, 2021, 07:29:50 pm by bplus »

#### SMcNeill

• QB64 Developer
• Forum Resident
• Posts: 3972
##### Re: Better way to moving 'sprites'
« Reply #10 on: August 07, 2021, 09:50:08 pm »
Sorite?, not Soarite? ;-))

Sprite with a typo, but it’s impossible to edit or correct it.  :P
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

#### RobinGravel

• Newbie
• Posts: 30
##### Re: Better way to moving 'sprites'
« Reply #11 on: August 08, 2021, 11:36:37 am »
I also downloaded Dragon Warrior 64 to take a look how its sprites work.

#### Cobalt

• QB64 Developer
• Forum Resident
• Posts: 878
• At 60 I become highly radioactive!
##### Re: Better way to moving 'sprites'
« Reply #12 on: August 08, 2021, 01:24:44 pm »
I also downloaded Dragon Warrior 64 to take a look how its sprites work.

Hooray for me. X)
Granted after becoming radioactive I only have a half-life!