0 Replies Latest reply on Mar 26, 2013 10:53 AM by kowetas

    Getting something to happen if a sprite is in one position for a period of time


      I am currently making a game where a ball drops and it has to be guided through platforms to the bottom of the screen. When the ball hits a platform, it animates and plays a sound. Everything is working up to this point, except when the ball hits a platform and comes to rest on it, both the animation and sound are triggered very rapidly as a consequence of the scripting.

      Basically what I wanted to know was whether there was a way to stop the sound and animation if it stayed in a particular Y-axis location for longer than a frame? This would be the easiest way to avoid the strobing as far as I can see.


        --if the ball intersects the paddle

          if (p_x + (p_width / 2) > (p_paddle7left)) and (p_x - (p_width / 2) < (p_paddle7right)) then


            --if it hits the top

            if p_y > (p_paddle7top - p_height / 2) and p_y < (p_paddle7bottom - p_height / 2) then

              p_vy = -1 * p_vy * p_ecoef

              p_y = float(p_paddle7top - p_height / 2)

              p_hit = "top"


              sprite(p_paddle7).member = member("yellowanim")

              member("yellowanim").loop = FALSE


                end if



              end if


      This is the part of my code that works all of that.


      Thanks in advance if anyone can help