Skip to content

Instantly share code, notes, and snippets.

@tomaes
Last active June 9, 2020 07:30
Show Gist options
  • Save tomaes/00e3fdcf9795facdce5574b132f3d448 to your computer and use it in GitHub Desktop.
Save tomaes/00e3fdcf9795facdce5574b132f3d448 to your computer and use it in GitHub Desktop.
My first game with "graphics" (ca. 1993, on C64) remade. Commodore Basic v2 + "Hires-Master" extension. (v2.6)
0 if peek(51300)<>83 then print "hires-master v1.0 required!": stop
1 j=56320
2 s=53280: si=54272
3 jl=123: jr=119: ju=126: jd=125
5 jx=127: jf=111: lx=319: ly=199
7 mx=160: my=100: lv=1: cn=1
9 r=26 : q=10 : bx=30
11 dim y(200): n$=chr$(13)
12 :::
14 poke s,0: poke s+1,0
16 init: gron
17 mode 2: size 2,2,15,0
18 for i=77 to lx-12 step 4: plot i,106: next
20 text 0, my-2-20, "d.b."+n$+"laser"+n$+"cannon"
22 mode 1: size 1,1,8,0
23 text 100,my+10,"joy#2: up/down > switch"
24 text 100,my+20," left/right > move"
25 text 100,my+30," fire > fire"
27 text 100,my+44," let's go!"
28 if peek(j)=jx then 28
29 :::
30 cls: mode 2
32 color lv,0
33 box bx,0,lx-bx+3,ly
34 for i=bx to lx-bx step 2: plot i,0: next
35 for i=ly to 2 step -4
36 : line bx,i,bx+2,i: line lx-bx+1,i,lx-bx+3,i: next
37 gosub 240
38 x=int(rnd(1)*((lx-2*bx-2*r)/q))*q+(bx+r):y=0
39 line x-r,1,x+r,1: for i=0 to 999: next
40 :::
42 if y-lv*12>0 then circle y(y-lv*12), y-lv*12, r
44 y=y+lv
60 m=peek(j)
62 x=x-(m=jl and x<(lx-bx-r))*q+(m=jr and x>bx+r)*q
64 if m=jd then cn=1: gosub 240
66 if m=ju then cn=2: gosub 240
74 circle x,y,r: y(y)=x
75 :::
76 if m<>jf then 130
77 if cn=1 then fy=ly
78 if cn=2 then fy=0
80 oy=my+(cn=2)*20-(cn=1)*20
92 line bx,fy,mx,oy: line lx-bx,fy,mx,oy: circle mx,oy,6
102 line bx,fy,mx,oy: line lx-bx,fy,mx,oy: circle mx,oy,6
110 fc=fc+1
115 if abs(mx-x)+abs(oy-y)>r then 130
117 gosub 440
120 lv=lv+1
122 h(cn)=h(cn)+1
123 for i=10 to r+10 step 4
124 : circle x,y,i: circle x,y,i-8: next
128 :::
129 on - (lv<16) goto 30: goto 140
130 if y<(ly-lv) then 40
131 gosub 444
132 for i=0 to 7
133 mode 0: block x-r,ly-1,x+r,ly: gosub 400
135 mode 1: block x-r,ly-1,x+r,ly: gosub 400: next
138 :::
140 ra=int(( lv/(fc+1)+(h(2)/(h(1)+h(2)+1))+lv/16 )/3*100 )
142 if lv=16 and h(2)=15 and fc<17 then ra=100
143 s$= " * report" +n$
144 s$=s$+ " + final level:" +str$(lv)+"/16"+n$
146 s$=s$+ " + shots fired:" +str$(fc)+n$
148 s$=s$+ " + upper cannon hits:" +str$(h(2))+n$
150 s$=s$+ " + skill rating achieved:" +str$(ra)+"%"
151 if ra=100 then s$=s$+"(!)"
153 s$=s$+n$+" fire: re-start, direction: exit"
154 mode 1
160 for i=my-28 to my+32 step 2
162 line bx+2,i,lx-bx-1,i
164 line bx+2,ly-i,lx-bx-1,ly-i: next
170 mode 0: text 0,my-8*3,s$
175 if peek(j)=jx then 175
178 if peek(j)=jf then ecls 0: run
180 :::
182 if ra<100 then 190
184 mode 2: color 1,0: ecls 0
186 for z=-99 to 99: turn abs(z*2), z and 7
188 : figure 160,100, "5556777666788877785558885666": next
189 goto 186
190 print "in '93 and '20 by tomaes"
192 poke s+1,6: poke s,14
193 groff: end
200 :::
240 mode 0: block lx-10,my,lx-4,my+9
242 mode 1: box lx-10,my,lx-4,my+9
246 block lx-8,my+2+(2-cn)*3, lx-6,my+4+(2-cn)*3
248 mode 2
260 return
300 :::
400 for ii=0 to 89: next: return
420 :
440 for ii=0 to 10: poke si+24,15:::::poke si+24,.: next: return
444 for ii=0 to 20: poke si+24,9:poke si+24,.:next: return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment