Login
Back to forumReply to this topicGo to last reply

Posted By

MMS
on 2022-12-10
13:45:53
 BASIC Starfield (convert from ZX Spectrum BASIC)

I just saw a nice little program on FB group "BASIC on the ZX Spectrum"

I just made a small modification on the code to add depth to the starfield (more distant star=lower luminance of the star) and certainly the stars in the distance move slower.
I changed to multicolor from the original HIRES to reduce the color collisions of the moving stars.

Certainly the speed is not so great, my Full Throttle 1350% makes it a little closer to the ZX Spectrum BasinC turbo speed.

You can use on YAPE the Screen "Paste From Clipboard" function (who are not so familiar)

Please let me know, if you could improve this version to something better, faster, more faithful
(certainly the commands could be compressed into one line and to use the shorter codenames for the faster code. Compilation may help a little, I will try)

Multicolor version:
5 REM PARALLAX STARFIELD by Krzysiek Chowaniak and Uwe Geiken
10 GOSUB 300
20 FOR I=1 TO N:X=X(I):DRAW0,X,Y(I)
22 X=X-V(I)
24 IF X<0 THEN X=159
26 REM Y(I)=INT(RND(0)*176)
30 COLOR1,2,V(I)-1:DRAW 1,X,Y(I):X(I)=X
32 NEXT I: GOTO 20
300 REM SETUP
310 X=0:N=150:DIM X(N):DIM Y(N):DIM V(N)
320 COLOR0,1:COLOR1,2,5:COLOR4,1
325 GRAPHIC3,1
330 FOR I=1 TO N
332 X(I)=INT(RND(0)*159)
334 Y(I)=INT(RND(0)*176)
336 V(I)=INT(6*RND(0))+1
338 NEXT I
340 RETURN

The HIRES version closer to the ZX Spectrum code:
(line 26 I do not understand, so I REM it above, for me it screws up the starfield "feeling", probably in BasinC it is the part of the IF command in line 24)

5 REM PARALLAX STARFIELD by Krzysiek Chowaniak and Uwe Geiken
10 GOSUB 300
20 FOR I=1 TO N:X=X(I):DRAW0,X,Y(I)
22 X=X-V(I)
24 IF X<0 THEN X=255
26 Y(I)=INT(RND(1)*176)
30 DRAW 1,X,Y(I):X(I)=X
32 NEXT I: GOTO 20
300 REM SETUP
310 X=0:N=50:DIM X(N):DIM Y(N):DIM V(N)
320 COLOR0,1:COLOR1,2,5:COLOR4,1
325 GRAPHIC1,1
330 FOR I=1 TO N
332 X(I)=INT(RND(0)*256)
334 Y(I)=INT(RND(0)*176)
336 V(I)=INT(5*RND(0))+1
338 NEXT I
340 RETURN

Have fun!

Posted By

George
on 2022-12-11
14:36:27
 Re: BASIC Starfield (convert from ZX Spectrum BASIC)

Great work, MMS! Very cool!

Posted By

Mad
on 2022-12-11
18:47:37
 Re: BASIC Starfield (convert from ZX Spectrum BASIC)

Nice looking starfield!

Posted By

Charles
on 2022-12-12
10:28:19
 Re: BASIC Starfield (convert from ZX Spectrum BASIC)

Cool stuff, I like it, especially the hires version, quite good speed :)



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024