I've made a one liner - called Line

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Fri Aug 02, 2019 9:35 pm

Replace this:

Code: Select all

LET k=4*(INKEY$<>"")-2
with this:

Code: Select all

LET k=2-4*(INKEY$="")
0 x

User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Fri Aug 02, 2019 9:45 pm

Replace this:

Code: Select all

FOR n=-e TO l*3: PRINT AT RND*17+2,RND*25+4;"*": BEEP .0001,60: NEXT n: INK 8: LET y=85: PLOT 8,y
with this:

Code: Select all

FOR y=84-l*3-e TO 84: PRINT AT RND*17+2,RND*25+4;"*": BEEP .0001,60: NEXT y: INK 8: PLOT 8,y
0 x

User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Fri Aug 02, 2019 9:55 pm

patters wrote:
Fri Aug 02, 2019 9:34 pm
Great, thanks Einar. I do prefer one pixel per level, and shorter too - who can argue with that. Thanks for all the help, it's been very educational.
I shall upload the finished game to https://patters.itch.io/line, and update all the screenshots, credits, etc.
You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
0 x

User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Fri Aug 02, 2019 9:55 pm

patters wrote:
Fri Aug 02, 2019 9:34 pm
Great, thanks Einar. I do prefer one pixel per level, and shorter too - who can argue with that. Thanks for all the help, it's been very educational.
I shall upload the finished game to https://patters.itch.io/line, and update all the screenshots, credits, etc.
You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
0 x

User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Fri Aug 02, 2019 10:08 pm

Here's just one more idea.

Since you have plenty of free space now, why don't you could play a short BEEP sequence before the game starts?

If you add a FOR/NEXT with variable 'l', then you can remove LET l=1 from the beginning, and also replace LET l=l+1 with NEXT l.

I mean, replace this:

Code: Select all

1 LET l=1: ... NEXT x: LET l=l+1: ...
with this:

Code: Select all

1 FOR l=-9 TO 0: BEEP .01,l+9: BEEP .01, l: NEXT l: ... NEXT x: NEXT l: ...
Give it a try :)
0 x

User avatar
patters
Dizzy
Posts: 52
Joined: Thu Apr 11, 2019 12:06 am

Re: I've made a one liner - called Line

Post by patters » Fri Aug 02, 2019 11:02 pm

Einar Saukas wrote:
Fri Aug 02, 2019 9:55 pm
You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
I'd prefer to confine it to itch.io at first because it offers some useful analytics and logging, then we can add it to ZXDB after a few weeks, like I did with Artillery.
0 x
25 years in the making: Artillery projectile motion simulation
20 years in the making: Line a one line arcade game

User avatar
patters
Dizzy
Posts: 52
Joined: Thu Apr 11, 2019 12:06 am

Re: I've made a one liner - called Line

Post by patters » Fri Aug 02, 2019 11:05 pm

Einar Saukas wrote:
Fri Aug 02, 2019 10:08 pm

Code: Select all

1 LET l=1: ... NEXT x: LET l=l+1: ...
with this:

Code: Select all

1 FOR l=-9 TO 0: BEEP .01,l+9: BEEP .01, l: NEXT l: ... NEXT x: NEXT l: ...
Give it a try :)
Hmm. I just tried that, but it seems to increment the level counter by two on each level completion which is odd, given that I tested something similar in BASIC out of curiosity just before implementing. I did definitely remove the LET l=l+1
EDIT - nevermind - it was my POKE jumping to the wrong statement number and hitting the first NEXT l again.
0 x
25 years in the making: Artillery projectile motion simulation
20 years in the making: Line a one line arcade game

User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Sat Aug 03, 2019 12:54 am

patters wrote:
Fri Aug 02, 2019 11:02 pm
Einar Saukas wrote:
Fri Aug 02, 2019 9:55 pm
You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
I'd prefer to confine it to itch.io at first because it offers some useful analytics and logging, then we can add it to ZXDB after a few weeks, like I did with Artillery.
Sure, no problem!

Thanks for allowing me to participate here, it was really fun! :)
0 x

User avatar
patters
Dizzy
Posts: 52
Joined: Thu Apr 11, 2019 12:06 am

Re: I've made a one liner - called Line

Post by patters » Sun Aug 04, 2019 11:18 pm

Final listing below. Einar, before I update my itch.io page, is there a better way to write that BEEP in the second statement?

Code: Select all

1 FOR l=-6 TO 0:
BEEP .02,(l+6)*5-10:
NEXT l:
FOR d=1 TO 3:
POKE 23693,65:
BORDER 0:
CLS :
INK 2:
FOR e=19 TO 20:
PLOT 268-e,69+l/2:
DRAW 0,e-82.1-l/2:
DRAW e+e-286,0:
DRAW 0,163:
DRAW 247,0:
DRAW 0,-e-44-l/2:
NEXT e:
PRINT INK 3;"LEVEL ";l;AT 20,28+d;"//"(d TO ):
INK RND*4+3.5:
FOR y=84-l*3-e TO 84:
PRINT AT RND*17+2,RND*25+4;"*":
BEEP .0001,60:
NEXT y:
INK 8:
PLOT 8,y:
FOR x=5 TO 124:
LET k=2-4*(INKEY$=""):
LET y=y+k:
POKE 23620*POINT (x+x,y),35:
DRAW 2,k:
NEXT x:
NEXT l:
BEEP .01,20:
BEEP .01,30:
POKE 23620,5+32*(l=e):
BEEP .2,-20:
NEXT d:
DIM a$(32):
INK 1+5*(l=e):
FOR n=0 TO 10:
PRINT AT n,0; OVER 1;a$;AT e-n,0;a$:
NEXT n:
PRINT AT 10,n; INK 7;"GAME OVER" AND l<e;"WELL DONE" AND l=e
0 x
25 years in the making: Artillery projectile motion simulation
20 years in the making: Line a one line arcade game

User avatar
Einar Saukas
Manic Miner
Posts: 949
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas » Sun Aug 04, 2019 11:24 pm

Code: Select all

BEEP .02,l*5+20
0 x

Post Reply