Forum Archive

Scene update()

resserone13

I was trying to have a timer update every time a sprite is tapped 20 times. I would like the code to be executed once every 20 taps. When I put the code in the update() it executes the code more than once more. How do I control this. I would like to have a condition checked all the time but only happen once whenever the condition is true.



        Def update(self):
            if self.tap_count == 20:
                   self.timer_value += 15

resserone13

I put this code under touch_began() and its how I want. Every time the button is clicked the amount of taps is checked and if it meets the condition it adds 15 to the time.


            if self.tap_count % 20 == 0 and self.tap_count != 0:
                self.timer_value += 15