Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Need to stop buffered taps from being executed

vatechtomvatechtom TorontoPosts: 129New Users @ @
I have a situation, where I tap one side of the screen and I need an animation to complete, it works fine, if I dont tap it too fast, but if i tap repeatedly, it seems taps are buffered, than instead of having the execution of 1 tap, 2 or 3 in a row are executed, this is the code I have...

     /// If Right Side Tap....
                
                                        
                    let wait = SKAction.wait(forDuration: 0.32)
                    let run = SKAction.run
                    {
                            self.opponent.createAnimations("get_straight_head_R")
                    }
                    self.run(SKAction.sequence([wait, run]))


I tried using isUserInteractionEnabled set to false, within the brackets, but that didnt work, i set it to true outside the brackets.

Replies

  • dev666999dev666999 Posts: 3,512New Users @ @ @ @ @
    edited November 2016
    @vatechtom

    With an IF statement, try using a Boolean to turn it on or off.

  • vatechtomvatechtom TorontoPosts: 129New Users @ @
    I tried it, didnt work...
      let wait = SKAction.wait(forDuration: 0.32)
                        let run = SKAction.run
                        {
                                self.isUserInteractionEnabled = false;
                                self.opponent.createAnimations("get_straight_head_R")
                                
                        }
                        self.isUserInteractionEnabled = true;
                        self.run(SKAction.sequence([wait, run]))
                        
    
    
    
  • dev666999dev666999 Posts: 3,512New Users @ @ @ @ @
    Don't use "isUserInteractionEnabled". It is not needed.

    Use a BOOL with an IF statement to turn it on or off.
  • vatechtomvatechtom TorontoPosts: 129New Users @ @
    like if (bool=true) type thing?
  • dev666999dev666999 Posts: 3,512New Users @ @ @ @ @
    edited November 2016
    vatechtom wrote: »
    like if (bool=true) type thing?

    Yes, that's the way to do it

    Set the condition true/YES.

    Then use an IF Stmt to check for YES. If so, fire createAnimations. Then set the condition false/NO, so that it does not fire again.

    Then somewhere outside all this, reset the condition back to true/YES



Sign In or Register to comment.