Toggle Navigation
Hatchery
Eggs
ugfxControlsQuest
__init__.py
Login
Register
__init__.py
Content
import ugfx, badge, utime, system val = 0 def clear_screen(): ugfx.clear(ugfx.WHITE) ugfx.flush() def msg(txt): clear_screen() ugfx.string(0, 0, txt, "pixelade13", ugfx.BLACK) ugfx.flush() def btn_fn(txt, pushed): global val if pushed: if txt == "DOWN!": val += 1 else: val = 0 msg(txt) def main(): global val badge.init() ugfx.init() ugfx.input_init() clear_screen() msg("3x down = exit") ugfx.input_attach(ugfx.BTN_B, lambda pressed: btn_fn("EXIT!", pressed)) ugfx.input_attach(ugfx.BTN_A, lambda pressed: btn_fn("ENTER!", pressed)) ugfx.input_attach(ugfx.JOY_DOWN, lambda pressed: btn_fn("DOWN!", pressed)) ugfx.input_attach(ugfx.JOY_UP, lambda pressed: btn_fn("UP!", pressed)) ugfx.input_attach(ugfx.JOY_RIGHT, lambda pressed: btn_fn("RIGHT!", pressed)) ugfx.input_attach(ugfx.JOY_LEFT, lambda pressed: btn_fn("LEFT!", pressed)) while True: if val > 2: system.home() utime.sleep_ms(100) main()