mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2025-04-06 20:37:22 +00:00
Add platformer sample, a work in progress by Beckett Bylsma
This commit is contained in:
parent
cc5806e482
commit
5ebbde151f
@ -86,6 +86,7 @@ By <a target=_blank href="mailto:inexorabletash@gmail.com">Joshua Bell</a>
|
||||
<option value="sample.spaceattack"> Space Attack! (Alan Ratliff)</option>
|
||||
<option value="sample.building"> Building (Melvin Rosario)</option>
|
||||
<option value="sample.artillery"> Artillery (Michael "Moose" O'Malley)</option>
|
||||
<option value="sample.platformer"> Platformer - work in progress (Beckett Bylsma)</option>
|
||||
|
||||
<option disabled>____________________________________________</option>
|
||||
<option disabled>Graphics</option>
|
||||
|
166
samples/sample.platformer.txt
Normal file
166
samples/sample.platformer.txt
Normal file
@ -0,0 +1,166 @@
|
||||
10 home
|
||||
11 let k=0
|
||||
12 let lives=5
|
||||
13 let key$="NO"
|
||||
14 let kx=29 :let ky=27
|
||||
15 let s=0
|
||||
16 let e=0
|
||||
17 print chr$(7) :home :print "SCORE:";score :print "LIVES:";lives :print "KEY OBTAINED?";key$
|
||||
18 let levelt=1
|
||||
19 let j=1
|
||||
20 gr
|
||||
21 color=6
|
||||
22 for q=1 to 39
|
||||
23 hlin 0,39 at k :let k=k+1
|
||||
24 next q
|
||||
25 color=10
|
||||
26 vlin 0,38 at 39
|
||||
27 color=13 :for sun=1 to 7
|
||||
28 hlin 1,4 at j :let j=j+1
|
||||
29 next sun
|
||||
30 color=13
|
||||
40 let cx=25 :let cy=19
|
||||
50 rem becketts new gravity improved (no bugs so far)
|
||||
60 plot cx,cy
|
||||
61 color=1 :plot kx,ky
|
||||
70 let X=12: let Y=23
|
||||
80 let score=0
|
||||
90 print "SCORE:";score
|
||||
91 print "LIVES:";lives
|
||||
92 print "KEY OBTAINED?";key$
|
||||
100 rem level plotter
|
||||
110 color=12
|
||||
120 dim z0(39,39)
|
||||
130 read x1,y1
|
||||
140 if x1=0 and y1=0 goto 300
|
||||
150 z0(x1,y1)=1
|
||||
160 plot x1,y1
|
||||
161 color=5
|
||||
162 plot x1,(y1+1) :color=12
|
||||
170 goto 130
|
||||
200 rem character printer
|
||||
210 color=2
|
||||
300 color=2
|
||||
310 plot x,y
|
||||
350 rem get key command
|
||||
450 let c$="":get c$
|
||||
451 if x<0 then let x=0
|
||||
452 if x>39 and levelt=1 then let x=39
|
||||
400 if X=25 and Y=19 and s=0 then htab(18):vtab(12):let score=score+1 :home :htab 1:vtab 23 :print "SCORE:";score :print "LIVES:" ;lives :print "KEY OBTAINED?";key$:let s=1 : gosub 100000 :goto 450
|
||||
401 if X=29 and Y=27 and e=0 then home :htab 1:vtab 23 :let key$="YES" :print "SCORE:";score :print "LIVES:" ;lives :print "KEY OBTAINED?";key$ :let e=1: gosub 200000 :goto 450
|
||||
402 if lives<1 then print "YOU LOSE!" :end
|
||||
500 if c$="W" goto 900
|
||||
600 if c$="A" then color=6 :plot x,y : let X=X-1 :color=2 :plot x,y :if z0(X,Y+1)=0 then goto 1200:if z0(X,Y+1)=1 then goto 300
|
||||
700 if c$="D" then color=6 :plot x,y :let X=X+1 :color=2 : plot x,y :if z0(X,Y+1)=0 then goto 1200:if z0(X,Y+1)=1 then goto 300
|
||||
800 goto 400
|
||||
900 for i=1 to 6: plot x,y
|
||||
910 gosub 3000
|
||||
920 color=6 :plot x,y :let Y=Y-1
|
||||
1010 for r=1 to 125
|
||||
1020 color=2 :plot x,y
|
||||
1080 next r
|
||||
1100 gosub 10000
|
||||
1190 next i
|
||||
1200 plot x,y
|
||||
1240 color=6 :plot x,y :let Y=Y+1
|
||||
1310 for o=1 to 75
|
||||
1320 color=2 :plot x,y
|
||||
1390 next o
|
||||
1400 gosub 10000
|
||||
1410 gosub 2000
|
||||
1420 goto 1200
|
||||
1440 goto 400
|
||||
10000 let k=PEEK(49152)
|
||||
10100 if k=196 and x<38 then color=6 :plot x,y :X=X+1
|
||||
10200 if k=193 and x>1 then color=6 :plot x,y :X=X-1
|
||||
10210 if z0(x,y)=1 and k=196 then let x=x-1 :plot x,y
|
||||
10220 if z0(x,y)=1 and k=193 then let x=x+1 :plot x,y
|
||||
10222 if z0(x,y+1)=1 and k=196 then let x=x-1 :plot x,y
|
||||
10223 if z0(x,y+1)=1 and k=193 then let x=x+1 :plot x,y
|
||||
10224 if z0(x,y-1)=1 and k=196 then let x=x-1 :plot x,y
|
||||
10225 if z0(x,y-1)=1 and k=193 then let x=x+1 :plot x,y
|
||||
10280 let k=PEEK(49168)
|
||||
10290 color=2 :plot x,y
|
||||
10300 return
|
||||
|
||||
2000 if z0(X,Y+1)=1 goto 400
|
||||
2001 if y=38 then color=6: plot x,y :let X=12: let Y=23 :color=2 :plot x,y :let lives=lives-1 :print chr$(7):home :print "SCORE:";score :print "LIVES:";lives :print "KEY OBTAINED?";key$ :goto 400
|
||||
2010 return
|
||||
|
||||
3000 if z0(X,Y-2)=1 goto 1200
|
||||
3024 return
|
||||
|
||||
|
||||
|
||||
99999 rem map data saver
|
||||
20000 data 1,24,2,24,3,24,4,24,5,24,6,24,7,24,8,24,9,24,10,24,11,24,12,24,13,24,14,24,15,24,16,24,17,24,18,24
|
||||
20005 data 20,28,21,28,22,28,23,28,24,28,25,28,26,28,27,28,28,28,29,28,30,28,31,28,32,28,33,28,34,28,35,28,36,28,37,28
|
||||
20010 data 20,20,21,20,22,20,23,20,24,20,25,20,26,20,27,20,0,0
|
||||
100000 print chr$(7) :home :print "SCORE:";score :print "LIVES:";lives :print "KEY OBTAINED?";key$:for w=1 to 6
|
||||
100001 let cy=cy-1
|
||||
100002 color=13 :plot cx,cy
|
||||
100003 for t=1 to 65
|
||||
100004 plot cx,cy
|
||||
100005 next t
|
||||
100006 color=6 :plot cx,cy
|
||||
100007 next w
|
||||
100008 print chr$(7) :home :print "SCORE:";score :print "LIVES:";lives :print "KEY OBTAINED?";key$:for w=1 to 4
|
||||
100009 let cy=cy+1
|
||||
100010 color=13 :plot cx,cy
|
||||
100011 for t=1 to 65
|
||||
100012 plot cx,cy
|
||||
100013 next t
|
||||
100014 color=6 :plot cx,cy
|
||||
100015 next w
|
||||
100016 color=2 :plot x,y
|
||||
100017 return
|
||||
200000 for w=1 to 6
|
||||
200001 let ky=ky-1
|
||||
200002 color=1 :plot kx,ky
|
||||
200003 for t=1 to 65
|
||||
200004 plot kx,ky
|
||||
200005 next t
|
||||
200006 color=6 :plot kx,ky
|
||||
200007 next w
|
||||
200008 print chr$(7) :home :print "SCORE:";score :print "LIVES:";lives :print "KEY OBTAINED?";key$:for w=1 to 4
|
||||
200009 let ky=ky+1
|
||||
200010 color=1 :plot kx,ky
|
||||
200011 for t=1 to 65
|
||||
200012 plot kx,ky
|
||||
200013 next t
|
||||
200014 color=6 :plot kx,ky
|
||||
200015 next w
|
||||
200016 color=2 :plot x,y :print chr$(7) :home :print "SCORE:";score :print "LIVES:";lives :print "KEY OBTAINED?";key$
|
||||
200017 color=6 :vlin 19,20 at 39 :for e=1 to 300
|
||||
200018 vlin 18, 21 at 39 :next e :for e=1 to 300
|
||||
200019 vlin 17,22 at 39 :next e :for e=1 to 300
|
||||
200020 vlin 16,23 at 39:next e :for e=1 to 300
|
||||
200021 vlin 15,24 at 39:next e :for e=1 to 300
|
||||
200022 vlin 14,25 at 39 :next e :for e=1 to 300
|
||||
200023 vlin 13,26 at 39 :next e
|
||||
200024 color=2 :vlin 19,20 at 39 :for e=1 to 325
|
||||
200025 color=3 :plot 39,18 :plot39,21 :next e :for e=1 to 325
|
||||
200026 color=2 :plot 39,17 :plot39,22 :next e :for e=1 to 325
|
||||
200027 color=3 :plot 39,16 :plot39,23:next e :for e=1 to 325
|
||||
200028 color=2 :plot 39,15:plot39,24:next e :for e=1 to 325
|
||||
200029 color=3 :plot 39,14 :plot39,25 :next e
|
||||
200030 for a=1 to 500
|
||||
200040 color=2: plot x,y
|
||||
200050 next a
|
||||
200060 for ab=1 to 7
|
||||
200070 color=6 :plot x,y :let y=y-1
|
||||
200080 for sus=1 to 85
|
||||
200090 color=2 :plot x,y
|
||||
200100 next sus
|
||||
200110 next ab
|
||||
200111 for wa=1 to 25
|
||||
200112 color=2 :plot x,y
|
||||
200113 next wa
|
||||
200120 for abc=1 to 10
|
||||
200130 color=6 :plotx,y :let x=x+1
|
||||
200140 for sus=1 to 85
|
||||
200150 color=2 :plot x,y
|
||||
200160 next sus
|
||||
200170 next abc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user