20 Lines: Robovic

Discussion, Reviews & High-scores

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4845
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Yep, placing statements after an ON ... GOTO, or ON ... GOSUB is something like a poor mans IF ... THEN ... ELSE on CBM BASIC V2. You're just restricted to the GOTO or GOSUB statement(s) in the "THEN" clause.
IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

I rewrote the input code, added custom graphics, and even added a "transporter" special effect. 8)

http://members.cox.net/mechdan/vic/robovic2.prg

The source code could be tightened up a bit, now that I realize that it's okay to simply set bx and mx to zero. The references to "pc" could all be replaced with "." since the player character is "@".

Code: Select all

1 poke36879,8:?"{clr}{wht}":poke56,28:clr:s=32:l=22:w=214:dimx(99):px=7910
2 pc=.:fort=.tol:poke7680+t,w:poke8185-t,w:poke7723+t*l,w:poke8142-t*l,w
3 poke7168+t,85:next:dimc(23),a%(255),xc(7):poke36869,255:pokepx,pc:goto16
4 pokepx,s:pokebx,s:bx=bx+bv:ifpeek(bx)=wthenbx=33333:bv=.
5 pokebx,bc:px=px-pv*(peek(px+pv)=s):pokepx,pc
6 t=rnd(.)*n:v=int((px-2)/l)-int((x(t)-2)/l):v=sgn(v)*l+sgn(px-x(t)-v*l)
7 ifpeek(x(t))-xcthenn=n-1:x(t)=x(n):t=.:ifn=.then18
8 ifmv=.theniflv>3thenmx=x(t):mv=v:mc=c(abs(v))
9 pokex(t),s:pokemx,s:mx=mx+mv:ifpeek(mx)=wthenmx=33333:mv=.
10 pokemx,mc:x(t)=x(t)-v*(peek(x(t)+v)<=s):pokex(t),xc
11 pokebx,s:bx=bx+bv:ifpeek(bx)=wthenbx=33333:bv=.
12 pokebx,bc:ifpeek(px)-pcthen?"{rvs}you died on level";lv:inputa$:run
13 geta$:ifa$=""then4:data1,,24,222,-21,,8,216,-22,,60,193,-23,,90,218
14 a=a%(asc(a$)):ifa>sthenpokebx,s:bx=px:bv=a-w:bc=c(abs(bv)):goto4
15 pv=a:goto4:data-1,195,24,215,21,206,40,211,22,221,40,166,23,205,108,164
16 fort=1to8:readv,c(abs(v)),q,xc(t-1):poke7167+t,q:poke7423+t,.
17 a%(asc(mid$("frewsxcv",t)))=v:a%(asc(mid$("loiujm,.",t)))=v+w:next
18 lv=lv+1:n=5+(63andlv):xc=xc(7andlv):fort=.ton-1
19 x(t)=7680+int(rnd(.)*506):ifpeek(x(t))-sthen19
20 pokex(t),xc:next:pokepx,pc:fort=-1to0:geta$:t=a$="":next:goto14
Even though the program is still rough around the edges, I can now be a little proud of how much is crammed into it. :D
User avatar
GreyGhost
Vic 20 Nerd
Posts: 525
Joined: Wed Oct 05, 2005 11:10 pm

Post by GreyGhost »

I just got time to sit down and really play this game. Amazing what we can do in just 20 lines of code. :wink:
Rob
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I miss the 20 line contests.
High Scores, Links, and Jeff's Basic Games page.
Post Reply