Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Start of the game
- import play
- from random import randint
- # Creating objects for external interface
- #### BOXES ####
- place1 = play.new_box(color = 'pink', x = -200, y = 0, width = 100, height = 200, border_width=5, border_color='plum')
- place2 = play.new_box(color = 'light sky blue', x = 0, y = 0, width = 100, height = 200, border_width=5, border_color='plum')
- place3 = play.new_box(color = 'orchid', x = 200, y = 0, width = 100, height = 200, border_width=5, border_color='plum')
- #### WELCOME MESSAGE ####
- #### RESULT MESSAGE ####
- #### PLAY BUTTON ####
- button = play.new_box(color = 'yellow', x = -0, y = -250, width = 200, height = 70, border_width=10, border_color='gold')
- button_text = play.new_text(words = 'Hello!',color='gold', x = -0, y = -250)
- #### BONUS TASKS: COUNTER AND MONEY ####
- # Generate random numbers
- num1_text = play.new_text(words = '', x = -200, y = 0, font = None, font_size = 100, color='white')
- num2_text = play.new_text(words = '', x = 0, y = 0, font = None, font_size = 100, color='white')
- num3_text = play.new_text(words = '', x = 200, y = 0, font = None, font_size = 100,color='white')
- # SETUP TIME
- @play.when_program_starts
- def start():
- num1_text.hide()
- num2_text.hide()
- num3_text.hide()
- # GAME RULES AND CONTROLS
- @play.repeat_forever
- def do():
- pass
- @button.when_clicked
- async def clicking():
- num1 = randint(0, 9)
- num2 = randint(0, 9)
- num3 = randint(0, 9)
- num1_text.words = str(num1)
- num2_text.words = str(num2)
- num3_text.words = str(num3)
- num1_text.show()
- num2_text.show()
- num3_text.show()
- await play.timer(seconds=2.0)
- num1_text.hide()
- num2_text.hide()
- num3_text.hide()
- play.start_program()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement