Your program can be interactive by using the sprite.ask block in the ACTIONS Toolkit. The answer is stored in a variable that you can then use to display the results or you can compare the results to something else.

#How to use the ASK block to make your project interactive # ACTIONS Toolkit - ASK Block # # sprite = codesters.Sprite("codesters",0,-25) fruit_choice = sprite.ask("What is your favorite fruit?") #The answer to the question is stored in the variable to the #left of the equal sign in the sprite.ask statement #Display the answer using the sprite.say block stage.wait(1) sprite.say(fruit_choice) stage.wait(2) sprite.say("My favorite too!") stage.wait(1) #Use the answer in an "if" statement to do a set of actions if fruit_choice == "apples": sprite.say("That is why I love fall!") stage.set_background("fall") else: stage.wait(1) sprite.say("Enjoy your fruit! Bye!")
Support