I was talking to a guy on Facebook about the BASIC Engine NG and trying to give him a little assistance. Since Kevin abandoned the BASIC Engine group over there some months back, I have pointed him to the official boards here 🙂
He was wanting a simple demo of loading sprites and moving sprites, so I put this together right fast. It loads 32 32x32 sprites and bounces them about a SCREEN 14 screen. I will try to remember to learn how GitHub works this weekend, but for now I will use a shared Google Drive folder.
In any case, Alexander, the links and such are below. The BASIC code will be listed below, but the graphical assets will have to be downloaded. If you'd rather, there is a 7zip archive of all the files needed. Regardless, they are all very small files. The first lines have basic descriptions of what the variables used are and what they do.
For those that are seasoned, please do not make too much fun of this 🙂
Google Drive Link: [https://drive.google.com/drive/folders/16fuIHSAPgBCmVP7FU9roqN2fbh5MfQMp?usp=sharing](https://)
CODE:
5 REM * * * * * * * * * * * * * * * *
6 REM License? If, for some weird
7 REM reason, you'd like to use this
8 REM code, please feel free to do so!
9 REM
10 REM Variable information:
11 REM SX(x) & SY(x) are sprite positions
12 REM for that particular sprite #
13 REM I.E.: SX(3) if the horizontal
14 REM position for sprite #3
15 REM MVX(X)&MVY(X)are SPRITE
16 REM movement increments for a given
17 REM sprite #. I.E.: MVX(3) is the
18 REM horizontal increment or decrement
19 REM value for sprite #3
20 REM Line 6040 has a RND value added
21 REM if necessary, to keep sprites
22 REM from bunching up together and
23 REM staying that way.
24 REM To change the potential upper end
25 REM of sprite movement speeds, change
26 REM the RND(5) in line 6025 for X axis
27 REM movement and RND(6) in line 6045
28 REM for Y axis movement.
29 REM Lines 6050 & 6055 will invert those
30 REM particular movement flags, so as
31 REM to move some sprites in opposite
32 REM directions to start ou.
33 REM
34 REM
35 REM I'm sure there are better ways to
36 REM do these things. It is the way
37 REM it is to make it easy(ish) to
38 REM read. I hope I didn't fail to badly
39 REM
40 REM Sprite assets are free to use images
41 REM from itch io
50 CPUSPEED 99
60 DIM SX(31),SY(31),MVX(31),MVY(31)
100 SCREEN 14:PALETTE 0
110 GOSUB &LOADSPRITEIMAGES
120 GOSUB &TURNALLSPRITESON
130 GOSUB &FILLUPSPRITEPOSITIONS
150 WHILE INKEY$=""
160 FOR LP=0 TO 31
170 SX(LP)=SX(LP)+MVX(LP)
175 SY(LP)=SY(LP)+MVY(LP)
180 IF SX(LP)>447 THEN
185 MVX(LP)=-MVX(LP)
190 SX(LP)=447
195 ENDIF
200 IF SX(LP)<0 THEN
205 MVX(LP)=-MVX(LP)
210 SX(LP)=0
215 ENDIF
220 IF SY(LP)>237 THEN
225 MVY(LP)=-MVY(LP)
230 SY(LP)=237
235 ENDIF
240 IF SY(LP)<0 THEN
245 MVY(LP)=-MVY(LP)
250 SY(LP)=0
255 ENDIF
265 MOVE SPRITE LP TO SX(LP),SY(LP)
270 NEXT LP
280 VSYNC
290 WEND
999 END
5000 &LOADSPRITEIMAGES
5005 LOAD IMAGE "P132X32.PNG" AS SPRITE 1
5010 LOAD IMAGE "P1S32X32.PNG" AS SPRITE 2
5015 LOAD IMAGE "P232X32.PNG" AS SPRITE 3
5020 LOAD IMAGE "P2S32X32.PNG" AS SPRITE 4
5025 LOAD IMAGE "P32X32.PNG" AS SPRITE 5
5030 LOAD IMAGE "P332X32.PNG" AS SPRITE 6
5035 LOAD IMAGE "P3S32X32.PNG" AS SPRITE 7
5040 LOAD IMAGE "P432X32.PNG" AS SPRITE 8
5045 LOAD IMAGE "P4S32X32.PNG" AS SPRITE 9
5050 LOAD IMAGE "P532X32.PNG" AS SPRITE 10
5055 LOAD IMAGE "P5S32X32.PNG" AS SPRITE 11
5060 LOAD IMAGE "P5S32X32.PNG" AS SPRITE 12
5065 LOAD IMAGE "P632X32.PNG" AS SPRITE 13
5070 LOAD IMAGE "P6S32X32.PNG" AS SPRITE 14
5075 LOAD IMAGE "P732X32.PNG" AS SPRITE 15
5080 LOAD IMAGE "P7S32X32.PNG" AS SPRITE 16
5085 LOAD IMAGE "P832X32.PNG" AS SPRITE 17
5090 LOAD IMAGE "P8S32X32.PNG" AS SPRITE 18
5095 LOAD IMAGE "P932X32.PNG" AS SPRITE 19
5100 LOAD IMAGE "P9S32X32.PNG" AS SPRITE 20
5105 LOAD IMAGE "P0S32X32.PNG" AS SPRITE 21
5110 LOAD IMAGE "P1032X32.PNG" AS SPRITE 22
5115 LOAD IMAGE "P132X32.PNG" AS SPRITE 23
5120 LOAD IMAGE "P1S32X32.PNG" AS SPRITE 24
5125 LOAD IMAGE "P232X32.PNG" AS SPRITE 25
5130 LOAD IMAGE "P2S32X32.PNG" AS SPRITE 26
5135 LOAD IMAGE "P32X32.PNG" AS SPRITE 27
5140 LOAD IMAGE "P332X32.PNG" AS SPRITE 28
5145 LOAD IMAGE "P3S32X32.PNG" AS SPRITE 29
5150 LOAD IMAGE "P432X32.PNG" AS SPRITE 30
5155 LOAD IMAGE "P4S32X32.PNG" AS SPRITE 31
5175 RETURN
5500 &TURNALLSPRITESON
5505 FOR LP=0 TO 31
5510 SPRITE LP SIZE 32,32 ON
5515 NEXT LP
5525 RETURN
6000 &FILLUPSPRITEPOSITIONS
6005 FOR LP=0 TO 31
6010 X=RND(447)
6015 Y=RND(237)
6020 SX(LP)=X:SY(LP)=Y
6025 MX=RND(5)
6030 IF MX=0 THEN MX=0.5
6035 MY=RND(5)
6040 IF MY=0 THEN MY=0.75+((RND(3)+1)/2)
6045 RXY=RND(6)
6050 IF RXY=3 THEN MX=-MX
6055 IF RXY=6 THEN MY=-MY
6060 MVX(LP)=MX
6065 MVY(LP)=MY
6070 NEXT LP
6080 RETURN