Toggle Navigation
Hatchery
Eggs
Drawer
__init__.py
Login
Register
__init__.py
Content
import ugfx, samd, system, sys, gc, time def vars(): global x,y,step,width, height x = 0 y = 0 step = 5 width = 128 height = 64 def action_exit(pushed): if (pushed): # go back to the home screen system.home() def action_down(pushed): global y, step, height if (pushed): if y + step <= height: y += step else: buzz_down() draw() def action_up(pushed): global y, step if (pushed): if y - step >= 0: y -= step else: buzz_up() draw() def action_left(pushed): global x, step if (pushed): if x - step >= 0: x -= step else: buzz_up() draw() def action_right(pushed): global x, step, width if (pushed): if x + step <= width: x += step else: buzz_down() draw() def buzz_up(): samd.buzzer(3,1) def buzz_down(): samd.buzzer(2,1) def start_music(): samd.buzzer(1,1) time.sleep(0.1) samd.buzzer(2,1) time.sleep(0.1) samd.buzzer(3,1) time.sleep(0.1) samd.buzzer(4,1) time.sleep(0.1) samd.buzzer(5,3) def draw(): ugfx.area(x,y,5,5,ugfx.BLACK) ugfx.flush() def main(): gc.collect() vars() draw() ugfx.input_init() ugfx.input_attach(ugfx.BTN_B,action_exit) #ugfx.input_attach(ugfx.BTN_START,enter)# fuck this button never work....(A or START or id:3 or what the fuck is this button) ugfx.input_attach(ugfx.JOY_UP,action_up) ugfx.input_attach(ugfx.JOY_DOWN,action_down) ugfx.input_attach(ugfx.JOY_LEFT,action_left) ugfx.input_attach(ugfx.JOY_RIGHT,action_right) start_music() sys.stdin.read(1) #Wait for any key action_exit(True) main()