home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1985 April / Ahoy_Magazine_85-04_1985_Double_L.d64 / joyvic (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  845b  |  45 lines

  1. 1 rem vic joystick
  2. 2 rem
  3. 3 rem stop this program by pressing joystick button!!!
  4. 4 rem
  5. 10 gosub 600:gosub 500
  6. 80 v=10:h=10
  7. 90 goto 140
  8. 97 rem
  9. 98 rem main movement loop
  10. 99 rem
  11. 100 s=(peek(37137)and 60)or (peek(37152)and 128)
  12. 101 if (s and 4)=0 then v=v-1
  13. 102 if (s and 8)=0 then v=v+1
  14. 103 if (s and 16)=0 then h=h-1
  15. 104 if (s and 128)=0 then h=h+1
  16. 105 if (s and 32)=0 then poke 37154,255:end
  17. 110 if h=hx and v=vx then 100
  18. 120 if v>be then v=v-bf
  19. 121 if v<0 then v=v+bf
  20. 122 if h>re then h=h-rf
  21. 123 if h<0 then h=h+rf
  22. 140 print vm$(vx)tab(hx)" "vm$(v)tab(h)pf$
  23. 150 hx=h:vx=v
  24. 190 goto 100
  25. 497 rem
  26. 498 rem set up movement strings
  27. 499 rem
  28. 500 dim vm$(be):vm$(0)=chr$(19)
  29. 510 for i=1 to be:vm$(i)=vm$(i-1)+chr$(17):next i
  30. 540 return
  31. 597 rem
  32. 598 rem set up screen margins
  33. 599 rem
  34. 600 re=20
  35. 605 rf=21
  36. 610 be=21
  37. 615 bf=22
  38. 620 pf$=chr$(122):rem player-figure
  39. 627 rem
  40. 628 rem screen color
  41. 629 rem
  42. 630 poke 36879,8:print chr$(147)
  43. 660 poke 37154,127:rem enable joystick (disables part of keyboard)
  44. 690 return
  45.