CPCWiki forum

General Category => Programming => Topic started by: Devilmarkus on 16:34, 31 March 13

Title: Twister?!? in BASIC
Post by: Devilmarkus on 16:34, 31 March 13
Code: [Select]
10 MODE 1:INK 0,0:INK 1,24:INK 2,6:INK 3,18:BORDER 0:OUT &BC00,6:OUT &BD00,24:a$=CHR$(207)+CHR$(143)+CHR$(207):pps2=300:pt2=4:pps=300:pt=8:xp=15:xs=4:xpa=15:xsa=3:xpb=15:xsb=2:LOCATE 1,1:PRINT CHR$(23);CHR$(1)
20 TAG:PLOT -4,-4,2:MOVE ((34-xp/2)*2)+pps,14:PRINT a$;:PLOT -4,-4,3:MOVE (xpa*2)+pps2,14:PRINT a$;:TAGOFF:LOCATE 1,25:PRINT CHR$(10)
30 xp=xp+xs:IF xp>20 THEN xs=xs-1 ELSE IF xp<8 THEN xs=xs+1
40 xpa=xpa+xsa:IF xpa>25 THEN xsa=xsa-1 ELSE IF xpa<8 THEN xsa=xsa+1
50 pps=pps+pt:IF pps>400 THEN pt=pt-4 ELSE IF pps<100 THEN pt=pt+4
60 pps2=pps2+pt2:IF pps2>400 THEN pt2=pt2-2 ELSE IF pps2<100 THEN pt2=pt2+2
70 GOTO 20

Not a real twister but perhaps you like the effect...
Title: Re: Twister?!? in BASIC
Post by: Gryzor on 01:33, 01 April 13
Wow, this is beautiful! And if you set WinApe to about 250-300% it could be a nice screensaver! :D
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 21:48, 01 April 13
And the next: Scroller for poor people:

Code: [Select]
10 MODE 1:INK 0,0:BORDER 0:INK 1,26:INK 2,3:INK 3,6:OUT &BC00,6:OUT &BD00,24
20 a$="Hello CPC freaks! "
30 LOCATE 8,10:PRINT"Hold on! Calculating..."
40 mx=LEN(a$)*8*8:DIM pix(mx)
50 FOR t=1 TO LEN(a$):LOCATE 1,25:PRINT MID$(a$,t,1)
60 FOR y=14 TO 0 STEP -2:FOR x=0 TO 14 STEP 2:pix(pt)=TEST(x,y):pt=pt+1:LOCATE 31,10:PRINT LEN(a$)-t:NEXT:NEXT
70 NEXT
80 pt=0:MODE 0:TAG:tk=200:tt=8:cl=1:FOR t=1 TO 15:READ a:INK t,a:NEXT
90 PLOT -2,-2,cl:FOR k=0 TO 7:IF pix(pt)=1 THEN MOVE tk+k*16,14:PRINT CHR$(133);
100 pt=pt+1:NEXT:TAGOFF:LOCATE 1,25:PRINT CHR$(10):TAG
110 IF pt=mx THEN pt=0
120 tk=tk+tt:IF tk>240 THEN tt=tt-1 ELSE IF tk<200 THEN tt=tt+1
130 cl=cl+1:IF cl=16 THEN cl=1
140 GOTO 90
150 DATA 1,2,11,23,22,18,9,12,24,25,15,6,3,4,5
Title: Re: Twister?!? in BASIC
Post by: TFM on 21:58, 01 April 13
Kicks Robins butt! Now Batman is next up...
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 22:04, 01 April 13
Yeah sure, TFM :D  8) 8) 8)

For the lazy people:
Twister:  [ You are not allowed to view attachments ]

Scroller:  [ You are not allowed to view attachments ]
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 00:18, 02 April 13
Update for the scroller:
Code: [Select]
10 MODE 1:INK 0,0:BORDER 0:INK 1,26:INK 2,3:INK 3,6:OUT &BC00,6:OUT &BD00,24:PAPER 1:PEN 0
20 a$="Hello CPC freaks! "
30 LOCATE 8,10:PRINT"Hold on! Calculating..."
40 mx=LEN(a$)*8*8:DIM pix(mx)
50 FOR t=1 TO LEN(a$):LOCATE 1,25:PRINT CHR$(24);MID$(a$,t,1);CHR$(24)
60 FOR y=14 TO 0 STEP -2:FOR x=0 TO 14 STEP 2:pix(pt)=TEST(x,y):pt=pt+1:LOCATE 31,10:PRINT LEN(a$)-t:NEXT:NEXT
70 NEXT
80 pt=0:MODE 0:CLS:TAG:tk=200:tt=8:cl=2:FOR t=1 TO 15:READ a:INK t,a:NEXT
90 PLOT -2,-2,cl:FOR k=0 TO 7:IF pix(pt)=1 THEN MOVE tk+k*16,14:PRINT CHR$(133);
100 pt=pt+1:NEXT:MOVE tk,14:DRAW tk+128,14,1:TAGOFF:LOCATE 1,25:PRINT CHR$(10):TAG
110 IF pt=mx THEN pt=0
120 tk=tk+tt:IF tk>240 THEN tt=tt-1 ELSE IF tk<200 THEN tt=tt+1
130 cl=cl+1:IF cl=16 THEN cl=2
140 GOTO 90
150 DATA 1,2,11,23,22,18,9,12,24,25,15,6,3,4,5


Title: Re: Twister?!? in BASIC
Post by: Gryzor on 21:15, 03 April 13
Heheheh loving it. As for the lazy ones, Winape auto-typing is easier :)
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 21:22, 03 April 13
And mine is faster... :P
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 21:26, 03 April 13
BASIC Autotype: Like you "LIST" a program:

BASIC Autotype (http://cpc-live.com/bastype/)
Title: Re: Twister?!? in BASIC
Post by: MartinW on 22:57, 03 April 13
Heheheh loving it. As for the lazy ones, Winape auto-typing is easier :)

Thank you SO much!! I typed the first one in the other day when it appeared but it took me so long I'd pretty much lost the will to live on the subject when I saw these new ones tonight so was about to ask if there was an easier way ;)
And yep, I realist the tape files are even easier but copy and paste means I don't have to download anything !
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 23:08, 03 April 13
I'm coding a BASIC demo...
With these effects and perhaps some more...

I wanted to call it "100% BASIC" so perhaps it will not have any music... But perhaps it will... ;)

So stay tuned ;)
Title: Re: Twister?!? in BASIC
Post by: TFM on 00:42, 04 April 13
Actually it would be cool to see what can be done by using "BASIC ONLY" ;-)
And music is doable ;-) I remember a basic program back the day, it made an awsome song.
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 00:44, 04 April 13
I already have a BASIC music ;)
It's cool! Really (No, I don't tell you now, who coded it)

But will be hard to implement... Perhaps a "Music part" ;)
Title: Re: Twister?!? in BASIC
Post by: TFM on 00:48, 04 April 13
Good luck!!!
Title: Re: Twister?!? in BASIC
Post by: Gryzor on 20:44, 06 April 13
MartinW: before the auto-type thingy I used to type a listing every once in a while but of course it takes lots of patience and the right mood. But since it was implemented it's been a savior :)


Markus: bring it on!!!
Title: Re: Twister?!? in BASIC
Post by: Devilmarkus on 13:05, 07 April 13
Another solution is to copy this text into a .txt file, rename it from .txt to .bas and put it onto a DSK.

The CPC can read it then. It takes a bit longer to load because it's ASCII, but should work fine ;)

Edit: Perhaps sometimes you need a BASIC program as ASCII on DSK:
No problem.
SAVE"MYPROG.BAS",A

Then you can extract it from your DSK using WinApe's filemanager or another good DSK editor and you'll have a pure text file.

AMSDOS and BASIC are more clever sometimes as you think ;)