2 Replies Latest reply on May 4, 2013 5:12 AM by James Newton, ACP

    Can I make a behavior 'pause' for a second before moving on to next line of script?


      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


          -- 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