If you want to run the code below the attached image has to be loaded into a paint program and saved as a .bmp file.
Code: Select all
screenres 640,480,32
color rgb(0,0,0),rgb(255,255,255):cls
dim shared as string actions(0 to 5)
actions(0)="SITTING"
actions(1)="EATING"
actions(2)="MEOWING"
actions(3)="SLEEPING"
actions(4)="PURRING"
actions(5)="PLAYING"
dim shared as any ptr actionCat
actionCat = imagecreate(983,328)
bload "actionCat.bmp",actionCat
dim shared as integer frame
dim shared as integer action
dim shared as integer counter 'count cycles to display same action
dim as double st
st = timer
action = int(rnd(1)*6)
sub display()
screenlock
cls
put (320-82,240-82),actionCat,(action*164,frame*164)-(action*164+163,frame*164+163),trans
locate 20,20
print actions(action)
screenunlock
end sub
sub update()
frame = frame + 1
if frame = 2 then frame = 0
counter = counter + 1
if counter = 5 then
counter = 0
action = int(Rnd(1)*6) 'choose one of six actions
end if
end sub
do
if (timer-st)> 0.5 then
st = timer 'reset start
display()
update()
end if
sleep 2
loop until multikey(&H01)