sync on
sync rate 0
Dim PlayerDeck(20) as string
global PlayerDeckMaxAmount = 20
global MouseClickToggle = 0
global mx
global my
global mc
set text opaque
do
mx = MouseX()
my = MouseY()
mc = MouseClick()
DrawCards()
UpdateCardName(mx, my, mc)
UpdateDeck()
if mc = 0 then MouseClickToggle = 0
sync
loop
end
function DrawCards()
for y = 1 to 5
for x = 1 to 5
box x*50, y*60, x*50+45, y*60+55, rgb(200,0,0), rgb(200,0,0), rgb(200,0,0), rgb(200,0,0)
set cursor x*50, y*60: print str$(x+y*5-5)
next x
next y
endfunction
function UpdateCardName(mx, my, mc)
set cursor 0,0: print " "
for y = 1 to 5
for x = 1 to 5
if mx > x * 50 && mx < x * 50 + 45 && my > y * 60 && my < y * 60 + 55
set cursor 0,0: print str$(x+y*5-5)
if mc > 0 && MouseClickToggle = 0
MouseClickToggle = 1
SelectCards(str$(x+y*5-5))
endif
endif
next x
next y
endfunction
function SelectCards(Card$)
if PlayerDeckMaxAmount > 0
dec PlayerDeckMaxAmount
PlayerDeck(20-PlayerDeckMaxAmount) = Card$
endif
endfunction
function UpdateDeck()
set cursor 400,0: print "Cards Available: " + str$(PlayerDeckMaxAmount) + " "
if PlayerDeckMaxAmount < 20
for i = 1 to 20 - PlayerDeckMaxAmount
set cursor 400,16+i*16: print PlayerDeck(i)
next i
endif
if PlayerDeckMaxAmount = 0
set cursor 0,0: print "No more cards available!"
endif
endfunction
You might try looking through that (sorry, I didn't have time to comment it. I've been pretty busy lately). And yes, you probably are going to want to use types for your card titles and such. Hope this helps!