rem
rem AGK Application
rem
dim box[100]
global boxN as integer
global boxI = 0
rem Landscape App
SetDisplayAspect( 4.0/3.0 )
SetPhysicsWallBottom( 0)
SetPhysicsWallTop(0)
SetRandomSeed(640)
boxI = LoadImage("box.bmp")
boxN = 1
rem A Wizard Did It!
do
CheckBox()
CreateBox()
Print(STR(box[boxN]))
if (GetSpriteexists(box[10])=1) then Print(STr(getSpriteY(box[10])))
Sync()
loop
function GetFreeSprite()
fsprite = 2
while GetSpriteExists(fsprite) =1
inc fsprite
endwhile
endfunction fsprite
function CreateBox()
inc boxN
if (boxN > 100) then boxN = 1
box[boxN] = GetFreeSprite()
CreateSprite(box[boxN],boxI)
SetSpriteScale(box[boxN],0.1,0.1)
SetSpritePosition(box[boxN],random(1,300),-10)
SetSpritePhysicsOn(box[boxN],2)
endfunction
function CheckBox()
for i = 1 to 100
if (GetSpriteExists(box[i]) ) then if (GetSpriteY(box[i])> 100) then DeleteSprite(box[i])
next i
endFunction
ok so what you see here is a simple box generator the problems im having is that for some reason the sprites dosenot get deleted if they passed the CheckBox function which checks for y value of the sprite if the y value have passed 100 the sprite is deleted . simple .. but dosent work , why? am i doing something wrong here? i am new to basic so maybe i dont notice something is should.
ty for your time.
nadav.