Advertisement
Armakuni

codice basic per semplice gioco di corse (aka F64)

Feb 23rd, 2019
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. 10 rem f64 game per c64
  2. 15 zz=rnd(-ti)
  3. 16 sc=0
  4. 18 poke 646,2:poke53280,2:poke53281,0
  5. 20 empt$=" ":rem lo spazio libero di ogni riga
  6. 30 ln$="{cm +}"+empt$+"{cm +}":rem la riga di strada
  7. 40 rc=7:rem limite spazi ke posso anteporre a ln$
  8. 50 sp=rc:rem sp sono gli spazi da anteporre alla riga di strada
  9. 60 lc=0:rem cache del precedente numero random
  10. 70 rp=0:rem contatore ripetizioni fatte di riga
  11. 75 dim c
  12. 78 dim ob
  13. 80 print"{clear}"
  14. 90 v=53248 : rem start of display chip
  15. 100 poke v+21,4:rem enable sprite 2
  16. 105 poke 53289,4
  17. 110 poke 2042,13:rem sprite 2 data from block 13
  18. 120 delta=3:rem delta pixel di movimento sprite
  19. 130 for n=0 to 62 : read q : poke 832+n,q : next
  20. 140 x=165:y=50:rem posizione iniziale
  21. 150 a=peek(56320):rem joystick porta 2
  22. 160 rem accelerazione
  23. 170 if a<>127 then delta=delta+1:rem se mi muovo accelero
  24. 180 if a=127 then delta=delta-1.5:rem se sto fermo decelero
  25. 190 if delta<3 then delta=3:rem non esageriamo
  26. 200 if delta>10 then delta=10:rem non esageriamo
  27. 210 rem movimenti navicella
  28. 220 if a=126 then y=y-delta
  29. 230 if a=125 then y=y+delta
  30. 240 if a=123 then x=x-delta
  31. 250 if a=119 then x=x+delta
  32. 260 if a=122 then y=y-delta:x=x-delta
  33. 270 if a=118 then y=y-delta:x=x+delta
  34. 280 if a=121 then y=y+delta:x=x-delta
  35. 290 if a=117 then y=y+delta:x=x+delta
  36. 300 if x<20 then x=20:rem bordi
  37. 310 if x>255 then x=255:rem bordi
  38. 320 if y<50 then y=50:rem bordi
  39. 330 if y>237 then y=237:rem bordi
  40. 340 poke v+4, x : rem update x coordinates
  41. 350 poke v+5, y : rem update y coordinates
  42. 360 rem scrolling
  43. 370 c=int(rnd(1)*3)+1:rem 1:aumenta spazi, 2:diminuisce spazi,3:invariato
  44. 380 if lc=0 and c=1 then sp=sp+1:rp=rp+1
  45. 390 if lc=0 and c=2 then sp=sp-1:rp=rp+1
  46. 400 if lc=1 then sp=sp+1:rp=rp+1:rem lc<>0 quindi cache c precedente in corso,
  47. 410 if lc=2 then sp=sp-1:rp=rp+1:rem aumentando le volte ke ripropongo il trend
  48. 420 if lc=3 then rp=rp+1:rem anche idle aumenta rp
  49. 430 if sp<rc then sp=rc
  50. 440 if sp>2*rc then sp=2*rc
  51. 450 pf$=""
  52. 460 for t=1 to sp
  53. 470 pf$=pf$+" "
  54. 480 next t
  55. 481 ob=int(rnd(1)*3) +1
  56. 490 if ob<3 or sc<6 then ?pf$+ln$:rem metto gli spazi prima della strada
  57. 492 if ob=3 and sc>5 then gosub 900:rem metto spazi prima della strada e ostacolo
  58. 495 if peek(53279)=4 goto 1000
  59. 500 if rp>rc then rp=0:lc=c:rem reset condizioni iniziali scrolling
  60. 505 sc=sc+1
  61. 510 goto 150
  62. 900 ob=int(rnd(1)*(len(ln$)-1))+1
  63. 910 l$=left$(ln$,ob)
  64. 920 r$=right$(ln$,len(ln$)-ob-1)
  65. 930 ?pf$+l$+"Q"+r$
  66. 940 return
  67. 1000 print"{clear}"
  68. 1005 poke v+21,0
  69. 1008 restore
  70. 1010 ? "fine corsa"
  71. 1015 ?"linee superate:"+str$(sc):?"ancora?(y o n)"
  72. 1016 get y$:if y$="" goto 1016
  73. 1018 if y$="y" then goto 16
  74. 1020 end
  75. 10000 rem
  76. 10010 data 0,0,0,0,0,0
  77. 10020 data 0,0,0,0,0,0
  78. 10030 data 0,0,0,0,0,0
  79. 10040 data 0,0,0,0,0,0
  80. 10050 data 0,0,0,255,255,255
  81. 10060 data 73,0,146,38,0,100
  82. 10070 data 16,0,8,8,24,16
  83. 10080 data 4,36,32,2,36,64
  84. 10090 data 1,36,128,0,153,0
  85. 10100 data 0,66,0,0,36,0
  86. 10110 data 0,24,0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement