I am having an issue understanding how to get playsprite working when I want to use certain frames for sprite death. frames 1-4 regular animation (loop), 5-8 sprite death(play once through). I am sure that my function is really wrong, but I am just going with what I know as of now.
What i want to happen.
sprites move across screen and animations 1-4 play (loop). This works fine.
a player kills sprite - then play animation 5 - 8, (noloop)
when when sprite resets it goes back to frames 1-4
I could get it to work if I ran a small repeat until loop with a sync(), but that was plain ugly.
Media load section
//Load pumpkin Images
for i = 0 to maxPumpkins
//SetSpriteGroup(i,pumpsGroup)
pumpkin[i].enemySpriteNum = CreateSprite(0)
SetSpriteSize(pumpkin[i].enemySpriteNum,40,40)
SetSpritePosition(pumpkin[i].enemySpriteNum,-100,-100)
for j = 1 to 8
iTmp = LoadImage("pumpkin0"+str(j)+".png")
AddSpriteAnimationFrame(pumpkin[i].enemySpriteNum,iTmp )
next j
next i
sprite hit/score/reset function
function checkForPumkinHit()
//Did player hit the pumpkin?
for i=1 to maxPumpkins
if pumpkin[i].enemySpriteNum=hitsprite
//remove = 1and GetSpriteCurrentFrame(pumpkin[i].enemySpriteNum) = 8
// PlaySprite( iSpriteIndex, fFps, iLoop, iFromFrame, iToFrame )
if GetSpritePlaying(pumpkin[i].enemySpriteNum) =1
stopSprite(pumpkin[i].enemySpriteNum)
SetSpriteFrame(pumpkin[i].enemySpriteNum, 5)
PlaySprite(pumpkin[i].enemySpriteNum,20,0,5,8)
//sync()
log("I am at the playSprite section")
endif
//hit
playSquishSound()
inc score, 10
inc levelScore
if levelScore = 20 then pass = 1
//speed up pumpkins?
inc squishedPumpkin
if squishedPumpkin = 5
inc speedup
squishedPumpkin=0
endif
if GetSpritePlaying(pumpkin[i].enemySpriteNum) = 0 // and GetSpriteCurrentFrame(pumpkin[i].enemySpriteNum) = 8
pumpkin[i].enemyIsActive=0
pumpkin[i].enemyX=-100
pumpkin[i].enemyY=Random(100,364)
pumpkin[i].enemySpeed=Random(1+speedup,5+speedup)
hitsprite=0
SetSpritePosition(pumpkin[i].enemySpriteNum,pumpkin[i].enemyX,pumpkin[i].enemyY)
endif
endif
next i
endfunction
Josh