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

  1. 1 rem commodore 64 joystick
  2. 2 rem
  3. 3 rem use second joystick port
  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(56320)
  12. 101 if (s and 1)=0 then v=v-1:if v<0 then v=v+bf
  13. 102 if (s and 2)=0 then v=v+1:if v>be then v=v-bf
  14. 103 if (s and 4)=0 then h=h-1:if h<0 then h=h+rf
  15. 104 if (s and 8)=0 then h=h+1:if h>re then h=h-rf
  16. 105 if (s and 16)=0 then end
  17. 110 if h=hx and v=vx then 100
  18. 140 print vm$(vx)tab(hx)" "vm$(v)tab(h)pf$
  19. 150 hx=h:vx=v
  20. 190 goto 100
  21. 497 rem
  22. 498 rem set up movement strings
  23. 499 rem
  24. 500 dim vm$(be):vm$(0)=chr$(19)
  25. 510 for i=1 to be:vm$(i)=vm$(i-1)+chr$(17):next i
  26. 540 return
  27. 597 rem
  28. 598 rem set up screen margins
  29. 599 rem
  30. 600 re=38
  31. 605 rf=39
  32. 610 be=23
  33. 615 bf=24
  34. 617 rem
  35. 618 rem player figure
  36. 619 rem
  37. 620 pf$=chr$(122)
  38. 627 rem
  39. 628 rem screen color
  40. 629 rem
  41. 630 poke 53281,1:poke 53280,1:print chr$(147)
  42. 690 return
  43.