Toggle Navigation
Hatchery
Eggs
ScoreBoard
__init__.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
__init__.py
raw
Content
# score board adjustable import rgb import buttons import defines import time rgb.clear() #global variables global Homescore global Guestscore global Score Homescore = 0 Guestscore = 0 Score = 0 # initial text print with default values rgb.text("Scoreboard start",(0,255,255)[255,255,0]) print("Scoreboard start",(0,255,255)[255,255,0]) # variables for buttons buttonup = 0 buttondown = 0 buttonright = 0 buttonleft = 0 buttona = 0 buttonb = 0 # button readout def Homescore(button_is_down): if button_is_down: global buttonup buttonup = 1 pass buttons.register(defines.BTN_UP, Score) def Guestscore(button_is_down): if button_is_down: global buttondown buttondown = 1 pass buttons.register(defines.BTN_DOWN, Score) def Guestscore(button_is_down): if button_is_down: global buttonright buttonright = 1 pass buttons.register(defines.BTN_RIGHT, Score) def Guestscore(button_is_down): if button_is_down: global buttonleft buttonleft = 1 pass buttons.register(defines.BTN_LEFT, Score) def textb(button_is_down): if button_is_down: global buttona buttona = 1 pass buttons.register(defines.BTN_A, textb) while True: time.sleep(0.05) if buttonup: Homescore += Score buttonup = 0 Score = 0 displaytext (Homescore - Guestscore); Print (Homescore - Guestscore) elif buttondown: Guestscore -= Score buttondown = 0 Score = 0 displaytext (Homescore - Guestscore) elif buttonright: guestcore += Score buttonright = 0 Score = 0 displaytext (Homescore - Guestscore) elif buttonleft: Homescore -= Score buttonleft = 0 Score = 0 displaytext (Homescore - Guestscore) elif buttona: Guestscore = 0 Homescore = 0 buttona = 0 displaytext (Homescore - Guestscore) elif buttonb: System.reboot() pass