Author Topic: Mouse Controller  (Read 1962 times)

0 Members and 1 Guest are viewing this topic.

Offline bikemadness

  • Amiga 1200
  • ****
  • Posts: 322
  • Karma: 25
  • Hard players don't go home.
    • View Profile
Mouse Controller
« on: November 04, 2021 »
PS2 didn't come with one, so...

D-Pad to move.

Ctrl to turn on/off hold.

Code: [Select]
z$="SOMEBODYSNAME"
letters=len(z$)
x=320
y=255
z=3
dim xa(letters)
dim ya(letters)
dim z$(letters)

for a=1 to letters
ya(a)=100
xa(a)=a*30+70
next a

dim go(16)
open window 640,512
repeat
setdrawbuf vm
vm=1-vm
setdispbuf vm
clear window
c=peek("port1")

for a=1 to 16
if and(c,2^(a-1))>0 go(a)=1
if and(c,2^(a-1))=0 go(a)=0
next a

if and(c,1024)<>0 con=1
if con=1 C=C+1
if C>2 C=2
if C=2 con=0
if and(c,1024)=0 C=0

if con=1 sw=sw+1
if sw>1 sw=0

if go(14)=1 then
for a=1 to letters
ya(a)=100
xa(a)=a*30+70
next a
endif

if go(8)=1 x=x-z
if go(6)=1 x=x+z
if go(5)=1 y=y-z
if go(7)=1 y=y+z

if sw=1 then
for a=1 to letters
if go(6)=1 and(x>xa(a)-10 and x<xa(a)+10) and(y>ya(a)-10 and y<ya(a)+10) xa(a)=xa(a)+z
if go(8)=1 and(x>xa(a)-10 and x<xa(a)+10) and(y>ya(a)-10 and y<ya(a)+10) xa(a)=xa(a)-z
if go(7)=1 and(x>xa(a)-10 and x<xa(a)+10) and(y>ya(a)-10 and y<ya(a)+10) ya(a)=ya(a)+z
if go(5)=1 and(x>xa(a)-10 and x<xa(a)+10) and(y>ya(a)-10 and y<ya(a)+10) ya(a)=ya(a)-z
next a
endif

if sw=1 then
setrgb 1,0,256,0
else
setrgb 1,256,256,256
endif
'line x,y to x+25,y
'line x+25,y to x+19,y+15
line x,y to x+19,y+15
line x,y to x+5,y+21

if x<0 x=0
if x>640 x=640
if y<0 y=0
if y>512 y=512

setrgb 1,256,256,256
for a=1 to letters
rectangle xa(a)-10,ya(a)-10 to xa(a)+10,ya(a)+10
text xa(a)-6,ya(a)+2,mid$(z$,a,1)
next a

until (1=0)

Have a Yahappy day.
I don't know what is wrong with the world - but I know how to fix it.