Hi ^_^
I've coded a simple racing game demo (not playable at moment) in 7 lines from scratch, (not optimized) on Locomotive Basic.
Here the code and happy coding :)
10 MODE 1:CALL &BD1C: DEF FNr(x,y,z)=x+SIN(c/y)*z:locate 10,18:PEN 6:print "S P R I N T - 7Lines"
20 randomize time:ink 0,0:border 0:a=0:pc=2
30 c=c+2:pc=pc+1:CALL &BD19:a=c mod 16:b=pc mod 14:d=FNr(6,16,1.2)
40 locate FNr(18,14,3),b+1:print " ":locate FNr(18,14,3),b+2:print " "+chr$(171)+" ";
50 locate d,a+1:pen 9+a mod 4: print " 0 O ";
60 locate FNr(18,16,1.,15:print " "+chr$(171)+" ";:goto 30
https://www.youtube.com/watch?v=W4mSvMb5_ps (https://www.youtube.com/watch?v=W4mSvMb5_ps)
This is very interesting.
There are a few things happening in there that I don't really understand, such as the graphical technique.
Anyway, there are lots of things that can be done to speed this up, so it will be very interesting to see it develop.
Some things I can think of:
- keep a table of sine values, and look them up as needed
- only print spaces where required (lines 40 and especially 50 have a lot of printing being done)
Quote from: ervin on 04:16, 09 October 18
There are a few things happening in there that I don't really understand, such as the graphical technique.
e.g.: MODE 1 and CALL &BD1C forces the CPC to 80 columns but it's still in mode 1 with four colours. It prints out half a character.
Quote from: HAL 6128 on 06:38, 09 October 18
e.g.: MODE 1 and CALL &BD1C forces the CPC to 80 columns but it's still in mode 1 with four colours. It prints out half a character.
Interesting... thanks for the clarification.
Hi ^_^,
i've update the code, and now, you can find it in github :)
https://github.com/FabrizioRadica/Sprint7lines
V1.1- add input keys
Quote from: Fabrizio Radica on 00:23, 09 October 18Hi ^_^
I've coded a simple racing game demo (not playable at moment) in 6 lines from scratch, (not optimized) on Locomotive Basic.
Here the code and happy coding :)
10 MODE 1:CALL &BD1C: DEF FNr(x,y,z)=x+SIN(c/y)*z:locate 10,18:PEN 6:print "S P R I N T - 7Lines"
20 randomize time:ink 0,0:border 0:a=0:pc=2
30 c=c+2:pc=pc+1:CALL &BD19:a=c mod 16:b=pc mod 14:d=FNr(6,16,1.2)
40 locate FNr(18,14,3),b+1:print " ":locate FNr(18,14,3),b+2:print " "+chr$(171)+" ";
50 locate d,a+1:pen 9+a mod 4: print " 0 O ";
60 locate FNr(18,16,1.,15:print " "+chr$(171)+" ";:goto 30
https://www.youtube.com/watch?v=W4mSvMb5_ps (https://www.youtube.com/watch?v=W4mSvMb5_ps)
um... isn't that 6 lines?
now in 7 :)
https://github.com/FabrizioRadica/Sprint7lines
Quote from: zhulien on 03:59, 12 October 18um... isn't that 6 lines?
IIRC you can locate 0,0 and print a control character for up, and you'll get a hardware scroll in basic - no need to update all the blocks one by one.
I find this quite impressive! Also, its basic (eh...) form really reminds me of the CPC's early days, with all the charm (no irony here) of typing in type-ins... :)