SP4CEBAR 2023-01-08 16:58 (Edited)
Remember my rotating rocket demo?
If you have a bunch of circles of different sizes you'll get a lot more flexibility.
It's now file based! Use my rocket building tool to build rockets
SP4CEBAR 2023-01-09 14:19 (Edited)
Update: rocket is loaded from ROM, the file is made with my rocket building tool using the sprite registers memory format
SP4CEBAR 2023-01-09 14:22 (Edited)
To view a rocket from a file, all you need is the characters from this program and these subprograms:
You need to CALL ROCKET_FROM_FILE(X,Y,A,F) where (X,Y) is the position on the screen to move the rocket to, and (A) is the angle in radians the rocket is rotated by, F is the file (ROM entry) to load from ROM
SUB ROCKET_FROM_FILE(X,Y,A,F)
S=SIZE(F)
COPY ROM(F),S TO $FE00
S=S\4
M0=0
M1=0
M2=0
M3=0
CALL ROT_MATRIX(A-0.5*PI,M0,M1,M2,M3)
FOR I=0 TO S
XX=SPRITE.X(I)-20
YY=SPRITE.Y(I)-64
CALL MATRIX(XX,YY,M0,M1,M2,M3)
SPRITE I,XX+X,YY+Y,
NEXT I
END SUB
SUB ROT_MATRIX(A,M00,M01,M10,M11)
M00=COS(A)
M01=SIN(A)
M10=-SIN(A)
M11=COS(A)
END SUB
SUB MATRIX(X,Y,M00,M01,M10,M11)
XX=X*M00+Y*M01
Y =X*M10+Y*M11
X=XX
END SUB
SP4CEBAR 2023-01-09 14:27 (Edited)
Here's a more optimized function for ROT_MATRIX:
SUB ROT_MATRIX(A,M00,M01,M10,M11)
M00=COS(A)
M01=SIN(A)
M10=-M01
M11=M00
END SUB
SP4CEBAR 2023-01-10 08:23 (Edited)
Update: it can now view a new file that allows more rockets to be stored, this file starts with a table of 256 bytes followed by sprite registers data, each byte in the table is the number of sprites in the sprite registers that form this scene
The new file can be displayed and rotated with CALL ROCKET_FILE(X,Y,A,F) This file needs the two matrix subprograms as well
SP4CEBAR 2023-01-10 08:40 (Edited)
Update bug fix: the old file was made with a buggy version of the tool, the new file (which is how it should be) didn't work yet
CALL ROCKET_FILE(X,Y,A,F) to use the new viewer
'SPRITE SCENES FILE
SUB ROCKET_FILE(X,Y,ANG,F)
A=0
S=0
SCENE=0
CALL GET_ADDR (ROM(F),A,SCENE)
CALL GET_TABLE(ROM(F),S,SCENE)
COPY A,S*4 TO $FE00
M0=0
M1=0
M2=0
M3=0
A=ANG
CALL ROT_MATRIX(A-0.5*PI,M0,M1,M2,M3)
FOR I=0 TO S
XX=SPRITE.X(I)-20
YY=SPRITE.Y(I)-64
CALL MATRIX(XX,YY,M0,M1,M2,M3)
SPRITE I,XX+X,YY+Y,
NEXT I
END SUB
SUB ROT_MATRIX(A,M00,M01,M10,M11)
M00=COS(A)
M01=SIN(A)
M10=-M01
M11=M00
END SUB
SUB MATRIX(X,Y,M00,M01,M10,M11)
XX=X*M00+Y*M01
Y =X*M10+Y*M11
X=XX
END SUB
SUB GET_ADDR(A0,A,SCENE)
A=A0+256
V=0
FOR I=0 TO SCENE-1
CALL GET_TABLE(A0,V,I)
ADD A,V*4
'ADD A,SCENES(I)
NEXT I
END SUB
SUB GET_TABLE(A,V,SCENE)
V=PEEK(A+SCENE)
END SUB