Mole Mash-sprite speed

Hi! I am doing the Mole Mash http://www.appinventor.org/content/CourseInABox/drawAnimate/MoleMash and I want to customize it. I've created two buttons so that pressing them I can increase or decrease the speed of the sprite. However, it does not work. The speed of the sprite is always the same and I do not know what I am doing wrong. Any ideas?
Screenshot 2021-08-07 14.51.10

Try something like this

@dora_paz Since you initialized the "speed" variable to 5, clicking the decrease speed button can cause the value to overflow into the negatives (10-5 = -5, after all, 5 is greater than 0).
Changing the initialization value to a multiple of 10 or changing to the IF condition for it to decrease the speed only when the speed is greater than 9 should work.

1 Like