Hi all! I'm making a carnival style 'Duck Shooter' game, where ducks swim across the stage at random speeds back and forth, the user is to 'shoot' as many ducks as possible within a given time limit. I've run into a problem that I can't seem to find any advice on though!
When the ducks are 'shot', they change to a cast member of the same duck, with 'blood' on it, then disappear offscreen (by a large offset) to return to the stage at random intervals to keep the game going until the time limit is up! However, the action of disappearing offscreen happens too fast, so you never see the blood splattered ducks! I tried putting the 'move off screen and change back to original unbloodied member on mouseUP, rather than on mouseDown (where the score stuff and sound effects happen), but, whilst this does work for the most part, if your 'click' isn't fast enough, the duck simply carries on swimming covered in blood, rather than disappearing offscreen.
What I need, is a delay after the original cast change BEFORE it goes offscreen and changes back, so that the blood splat can be seen. But I dunno how? Here's a code snippet....
if (pDuckSprite = sprite(9)) or (pDuckSprite = sprite(10)) or (pDuckSprite = sprite(11)) then
-- Remove one from score
set gvScore = gvScore -1
-- Play 'fail' sound
puppetSound 3, member "duck_quack"
-- 'shoot' the duck
sprite(me.spriteNum).member = 12 <--- changes to bloodied duck
BEHAVIOUR PAUSE HERE?
-- Move duck off screen to return later
pDuckSprite.locH = pDuckSprite.locH - 2000
-- change back to 'unshot' duck
sprite(me.spriteNum).member = 9 <-- changes back to original duck
Any help will be much appreciated
Solved it! For anyone else with similar issues, I used a quick timer to pause the stage for 1/10th of a second before moving on using the following code;
-- wait for a split second (so user can see blood splatter before next action executes!!)
repeat while the timer < 0.1*60
Try this in the Message window:
This uses a timeOut object and does not freeze the stage for the other ducks. You can set pRemoveDelay to 100 (milliseconds) to get the same effect as in your version.