This program will download the needed sprite sheet from my website and then run. It's a small file, only about 40k.
- Dav
Code: Select all
'cards.txt v1.0 (iphone/ipad)
'Demos a nice deck of cards using a sprite sheet.
'Downloads 'cards.png' sprite sheet from internet.
'You can use this sprite sheet to make card games.
'The sprite sheet is small, only 40k in size.
'Coded by Dav, OCT/2017
'NOTE: This programs saves 'cards.png' in current dir.
' On first run it will download it off internet.
option base 1
if not file_exists("cards.png") then
gosub download
end if
graphics
graphics clear 0,.5,.2
get screen size sw,sh
sprite "cards" load "cards.png", 14,4
sprite "cards" show
'Now show all frames of sprite...
'(52 number cards, 2 backs, 2 jokers)
do
for f =1 to 56
refresh off
sprite "cards" frame int(rnd(55))+1
sprite "cards" at rnd(sw),rnd(sh) scale rnd(2)+1 angle rnd(255)/255
sprite "cards" stamp
refresh on
pause .01
next f
until forever
end
'=======
download:
'=======
url$="www.qbasicnews.com/dav/files/cards.png"
print
print
print
print "DOWNLOAD CARDS.PNG SPRITE SHEET?"
print
print "This program requires the file cards.png.";
print "It is only about 40k in file size and will ";
print "download from: http://"&url$
print
print "It will be saved in the current folder. ";
print "You will only have to download it once ";
print "unless you delete the cards.png file."
print
button "download" text "Proceed" at 25,10
button "no" text "Not now, maybe later" at 150,10
do
if button_pressed("no") then end
until button_pressed("download")
button "download" delete
button "no" delete
if system_ext_ip$() ="" then
print "Error!"
print
print "You do not appear to be online. ";
print "Please connect to the internet first and ";
print "try running program again."
print
print "STOPPED..."
end
end if
print "Downloading..."
http url$ getdim m
file "cards.png" writedim m
return