Would you like to play a game?



  • Just created my first game in UIFlow called reaction.
    This is a 2 player game built in just UIFlow.
    Here is the micropython code

    from m5stack import *
    from m5ui import *
    from square import Square
    
    clear_bg(0x111111)
    
    
    emoji = Square(7, 7, 15, 9, lcd)
    btnA = M5Button(name="ButtonA", text="Player 1", visibility=True)
    btnB = M5Button(name="ButtonB", text="Start", visibility=True)
    btnC = M5Button(name="ButtonC", text="Player 2", visibility=True)
    
    import random
    
    
    
    while True:
      wait(1)
      wait(random.randint(0, 4))
      emoji.show_map([[0,0,0,0,0,0,0],[0,1,1,1,1,1,0],[0,1,1,0,1,1,0],[0,1,0,1,0,1,0],[0,1,1,0,1,1,0],[0,1,1,1,1,1,0],[0,0,0,0,0,0,0]], 0xFF0000)
      wait(1)
      lcd.clear()
      while (buttonA.wasReleased()) and (buttonC.wasReleased()):
        wait(1)
      if buttonA.wasPressed():
        emoji.show_map([[0,0,0,1,0,0,0],[0,0,1,1,0,0,0],[0,1,1,1,0,0,0],[1,1,1,1,1,1,1],[0,1,1,1,0,0,0],[0,0,1,1,0,0,0],[0,0,0,1,0,0,0]], 0x33cc00)
      if buttonC.wasPressed():
        emoji.show_map([[0,0,0,1,0,0,0],[0,0,0,1,1,0,0],[0,0,0,1,1,1,0],[1,1,1,1,1,1,1],[0,0,0,1,1,1,0],[0,0,0,1,1,0,0],[0,0,0,1,0,0,0]], 0x3366ff)
      wait(1)
      lcd.clear()
      wait(0.001)

  • M5Stack

    @ajb2k3
    Expect



  • @watson huh?