Hey can somebody tell me why this don't work?
Rem Project: Jack LOL Animation System
Rem Created: 3/19/2007 6:05:53 PM
Rem ***** Main Source File *****
rem init
sync on : sync rate 0
rem animation system type
type t_anim
id as integer
spr as integer
x as integer
y as integer
prio as integer
imgStart as integer
imgEnd as integer
delay as integer
time as integer
playing as boolean
frame as integer
maxFrames as integer
endtype
create bitmap 1,40,40 : set current bitmap 1
for i=1 to 4
circle 25,25,i+10
get image i,0,0,40,40,1
cls
next i
delete bitmap 1 : set current bitmap 0
rem initialize animation system
animObj as animSys
animObj=animSys.new()
for i=1 to 20
rem add animation
animId=animSys.free(animObj)
animSys.add(animObj,animId,freeSprite(),rnd(400),rnd(400),1,1,4,rnd(400)+100)
rem play the animation
animSys.play(animObj,animId)
next i
rem main loop
do
rem clean screen
cls
rem update animations
animSys.update(animObj)
rem update screen
fastsync
rem end of main loop
loop
function freeSprite()
repeat
inc i,1
until sprite exist(i)=0
endfunction i
`********************
`* Animation System *
`********************
class animSys
declarations
dim anim(0) as t_anim
enddeclarations
constructor new()
endconstructor
destructor destroy()
enddestructor
method add(this as animSys,id as integer,spr as integer,x as integer,y as integer,prio as integer,imgStart as integer,imgEnd as integer,delay as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
if result=0
array insert at bottom anim(0)
ind=array count(anim(0))
anim(ind).id=id
anim(ind).spr=spr
anim(ind).x=x
anim(ind).y=y
anim(ind).prio=prio
anim(ind).imgStart=imgStart
anim(ind).imgEnd=imgEnd
anim(ind).delay=delay
anim(ind).time=0
anim(ind).playing=0
anim(ind).frame=1
anim(ind).maxFrames=anim(ind).imgEnd-anim(ind).imgStart
sprite anim(ind).spr,0,0,anim(ind).imgStart
set sprite priority anim(ind).spr,anim(ind).prio
set sprite anim(ind).spr,0,1
else
exit prompt "ID with the same number was added.","Animation Debugger" : end
endif
endmethod
method play(this as animSys,id as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
anim(result).playing=1
endmethod
method stop(this as animSys,id as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
anim(result).playing=0
endmethod
method setFrame(this as animSys,id as integer,frame as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
anim(result).frame=frame
endmethod
method delete(this as animSys,id as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
delete sprite anim(result).spr
array delete element anim(0),result
endmethod
method free(this as animSys)
repeat
inc id,1
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
until result=0
endmethod id
method setPos(this as animSys,id as integer,x as integer,y as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
anim(result).x=x
anim(result).y=y
endmethod
method getPosX(this as animSys,id as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
res=anim(result).x
endmethod res
method getPosY(this as animSys,id as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
res=anim(result).y
endmethod res
method reset(this as animSys,id as integer)
for i=1 to array count(anim(0))
if anim(i).id=id
result=i
exit
else
result=0
endif
next i
anim(result).frame=1
endmethod
method update(this as animSys)
for i=1 to array count(anim(0))
if anim(i).playing
if anim(i).time=0 then anim(i).time=timer()
if timer()=>anim(i).time+anim(i).delay
if anim(i).frame=anim(i).maxFrames
anim(i).frame=1
else
anim(i).frame=anim(i).frame+1
endif
anim(i).time=timer()
endif
sprite anim(i).spr,anim(i).x,anim(i).y,anim(i).frame+(anim(i).imgStart-1)
endif
next i
endmethod
endclass
Thanks in Advance