Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from m5stack import *
- from m5ui import *
- from uiflow import *
- setScreenColor(0x222222)
- rectangle0 = M5Rect(145, 105, 30, 30, 0xFFFFFF, 0xFFFFFF)
- joystick = unit.get(unit.JOYSTICK, unit.PORTA)
- x=145
- y=105
- while True:
- if joystick.Y<=260 and joystick.Y>=220 and joystick.X<140 and joystick.X>110:
- y=y-1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.Y<=30 and joystick.Y>=0 and joystick.X<140 and joystick.X>110:
- y=y+1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=260 and joystick.X>=220 and joystick.Y<=140 and joystick.Y>=110:
- x=x+1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=30 and joystick.X>=0 and joystick.Y<140 and joystick.Y>110:
- x=x-1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=150 and joystick.Y>125:
- x=x-1
- y=y-1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=180 and joystick.Y>150:
- x=x-1
- y=y-2
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=210 and joystick.Y>180:
- x=x-1
- y=y-3
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=260 and joystick.Y>210:
- x=x-1
- y=y-4
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=115 and joystick.Y>90:
- x=x-1
- y=y+1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=90 and joystick.Y>60:
- x=x-1
- y=y+2
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=60 and joystick.Y>30:
- x=x-1
- y=y+3
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=110 and joystick.X>=0 and joystick.Y<=30 and joystick.Y>0:
- x=x-1
- y=y+4
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=150 and joystick.Y>125:
- x=x+1
- y=y-1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=180 and joystick.Y>150:
- x=x+1
- y=y-2
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=210 and joystick.Y>180:
- x=x+1
- y=y-3
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=260 and joystick.Y>210:
- x=x+1
- y=y-4
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=115 and joystick.Y>90:
- x=x+1
- y=y+1
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=90 and joystick.Y>60:
- x=x+1
- y=y+2
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=60 and joystick.Y>30:
- x=x+1
- y=y+3
- rectangle0.setPosition(x,y)
- wait(0.1)
- elif joystick.X<=240 and joystick.X>=130 and joystick.Y<=30 and joystick.Y>0:
- x=x+1
- y=y+4
- rectangle0.setPosition(x,y)
- wait(0.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement