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
patters
Dizzy
Posts: 52
Joined: Thu Apr 11, 2019 12:06 am

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

Post by patters » Wed Jul 31, 2019 6:13 pm

patters wrote:
Wed Jul 31, 2019 11:31 am
Here is a version which sacrifices the better sounds in order to offer the player three lives with a visual indicator in the bottom right of the screen.
Updated again to combine the creation of the gate into the red playfield outline loop. Is there a tighter way to encode these DRAW operations I wonder...

Code: Select all

READ p,q,e,l,d$:
FOR d=0 TO 2:
POKE q,65:
BORDER 0:
CLS :
INK 2:
LET g=8*(l>9)
PLOT 2,170:
FOR n=0 TO 1:
DRAW 247,0:
DRAW 0,n-66-g:
PLOT 249-n,71+g:
DRAW 0,n-65-g:
DRAW n+n-248,0:
DRAW 0,163:
NEXT n:
PRINT INK 3;"LEVEL ";l;AT 20,29+d; INK 1;d$( TO 2-d):
INK RND*4+3.5:
FOR n=0 TO l*3+e:
PRINT AT RND*18+1.5,RND*26+3.5;"*":
NEXT n:
INK 8:
LET y=85:
PLOT 8,y:
FOR x=5 TO 125:
LET k=4*(INKEY$<>"")-2:
LET y=y+k:
POKE p*POINT (2*x,y),34:
DRAW 2,k:
NEXT x:
LET l=l+1:
BEEP .02,30:
POKE p,3+33*(l=e):
BEEP .2,-e:
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:
DATA 23620,p+73,21,1,"//"
Download link
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 » Wed Jul 31, 2019 6:49 pm

Instead of this:

Code: Select all

FOR d=0 TO 2: ...       PRINT INK 3;"LEVEL ";l;AT 20,29+d; INK 1;d$( TO 2-d)
Use this:

Code: Select all

FOR d=1 TO 3: ...       PRINT INK 3;"LEVEL ";l;AT 20,28+d; INK 1;d$(d TO )
However the lives indicator looks much better using INK 3. In this case, the code will be much shorter:

Code: Select all

FOR d=1 TO 3: ...       PRINT INK 3;"LEVEL ";l;AT 20,28+d;d$(d TO )
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 » Wed Jul 31, 2019 6:56 pm

Replace:

Code: Select all

FOR n=0 TO l*3+e
with:

Code: Select all

FOR n=-e TO l*3
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 » Wed Jul 31, 2019 7:10 pm

You can also consider replacing this:

Code: Select all

PRINT AT RND*18+1.5,RND*26+3.5;"*"
with this:

Code: Select all

PRINT AT RND*17+2,RND*25+4;"*"
It won't work exactly the same way, since the incidence of stars in the first and last rows, also first and last columns, will be reduced by 50%. But I think it looks even better this way. It looks good to have a higher concentration of stars closer to the center of the galaxy, not as many stars near the edge...

Alternatively you could expand the stars area sideways, to make the game a little more challenging, as follows:

Code: Select all

PRINT AT RND*17+2,RND*27+3;"*"
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 » Wed Jul 31, 2019 8:14 pm

I suggest replacing this:

Code: Select all

POKE p*POINT (2*x,y),34
with this:

Code: Select all

POKE p*POINT (x+x,y),34
It's the same size, but runs a little bit faster.
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 » Wed Jul 31, 2019 8:40 pm

patters wrote:
Wed Jul 31, 2019 6:13 pm
Updated again to combine the creation of the gate into the red playfield outline loop. Is there a tighter way to encode these DRAW operations I wonder...
To produce exactly the same red outline, replace this:

Code: Select all

LET g=8*(l>9): PLOT 2,170: FOR n=0 TO 1: DRAW 247,0: DRAW 0,n-66-g: PLOT 249-n,71+g: DRAW 0,n-65-g: DRAW n+n-248,0: DRAW 0,163: NEXT n
with this:

Code: Select all

LET g=8*(l>9): FOR n=0 TO 1: PLOT 249-n,71+g: DRAW 0,n-65-g: DRAW n+n-248,0: DRAW 0,163: DRAW 247,0: DRAW 0,-n-65-g: NEXT n
However, gameplay works much better if the gate becomes gradually narrower after each level, instead of reducing size only once at level 10. This change will also make this code a lot shorter:

Code: Select all

FOR n=0 TO 1: PLOT 249-n,63+l: DRAW 0,n-57-l: DRAW n+n-248,0: DRAW 0,163: DRAW 247,0: DRAW 0,-n-57-l: NEXT n
0 x

User avatar
Spud
Microbot
Posts: 193
Joined: Sun Nov 12, 2017 8:50 pm

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

Post by Spud » Wed Jul 31, 2019 8:43 pm

Great game, managed to get to level 15 so far.

Probably the best Speccy release this year. (It is the only one I've played though :P)
1 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 » Wed Jul 31, 2019 8:53 pm

Replace this:

Code: Select all

READ p,q,e,l,d$: ... POKE q,65: ... DATA 23620,p+73,21,1,"//"
with this:

Code: Select all

READ p,e,l,d$: ... POKE p+73,65: ... DATA 23620,21,1,"//"
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 » Wed Jul 31, 2019 10:04 pm

To backtrack a bit...
Einar Saukas wrote:
Tue Jul 30, 2019 4:23 pm
Don't use parenthesis unless really necessary. For instance, you can save 2 characters replacing...
This is original code from 1996 which I had missed. :oops:
Einar Saukas wrote:
Tue Jul 30, 2019 4:23 pm
This way, users would be able to play the game using whatever key they prefer.
This is a great improvement because it means the game no longer needs instructions. To cover the only remaining non-intuitive aspect, I had wondered about putting LEVEL x/20 at the top left, to make it clear that there is a goal, but in my opinion it spoils the clean presentation.
Einar Saukas wrote:
Wed Jul 31, 2019 6:49 pm
However the lives indicator looks much better using INK 3
I hadn't tried that but I agree, now there's a consistent design for HUD elements. I had suspected it wouldn't be obvious what the slashes referred to, but this does look better, and it's very clear.
Einar Saukas wrote:
Wed Jul 31, 2019 7:10 pm
It won't work exactly the same way, since the incidence of stars in the first and last rows, also first and last columns, will be reduced by 50%. But I think it looks even better this way. It looks good to have a higher concentration of stars closer to the center of the galaxy, not as many stars near the edge...
Yes this is better because star placement in that first and last column can spoil levels making success more dependent on luck than skill alone. This mitigates that effect.
Einar Saukas wrote:
Wed Jul 31, 2019 8:40 pm
However, gameplay works much better if the gate becomes gradually narrower after each level, instead of reducing size only once at level 10. This change will also make this code a lot shorter.
I also spent some time coding that then I realised it results in quite significant red colour clash (more so than for the obstacles). Also I saw some collision detection issues relating to the grid alignment and only checking every 2 pixels of line progression, so this deterred me from implementing. I didn't really like that the gate has to start a fair bit wider without resorting to some scaling, which would add characters.

Thanks for the awesome work on all the other enhancements. I have been able to reinstate the satisfying pattering sound of the obstacle placement and the level-up plink sound, which I think are actually quite catchy elements of the game. The only thing I'm not entirely happy with now is the death sound. I need it to be long enough you can see how you died before the screen is redrawn (without relying on a PAUSE), and I want it to be an irritating sound to contrast the nicer sounds. However, a single tone doesn't seem enough...

Latest listing:

Code: Select all

READ p,e,l,d$:
FOR d=1 TO 3:
POKE p+73,65:
BORDER 0:
CLS :
INK 2:
LET g=8*(l>9):
FOR n=0 TO 1:
PLOT 249-n,71+g:
DRAW 0,n-65-g:
DRAW n+n-248,0:
DRAW 0,163:
DRAW 247,0:
DRAW 0,-n-65-g:
NEXT n:
PRINT INK 3;"LEVEL ";l;AT 20,28+d;d$(d TO ):
INK RND*4+3.5:
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:
FOR x=5 TO 125:
LET k=4*(INKEY$<>"")-2:
LET y=y+k:
POKE p*POINT (x+x,y),35:
DRAW 2,k:
NEXT x:
LET l=l+1:
BEEP .01,20:
BEEP .01,30:
POKE p,3+34*(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:
DATA 23620,21,1,"//"
Download link
Last edited by patters on Wed Jul 31, 2019 10:51 pm, edited 3 times in total.
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 » Wed Jul 31, 2019 10:26 pm

Spud wrote:
Wed Jul 31, 2019 8:43 pm
Great game, managed to get to level 15 so far.

Probably the best Speccy release this year. (It is the only one I've played though :P)
Thanks. High praise indeed :)
0 x
25 years in the making: Artillery projectile motion simulation
20 years in the making: Line a one line arcade game

Post Reply