🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Would you like to play a game?

    UIFlow
    2
    3
    3.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ajb2k3A
      ajb2k3
      last edited by

      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)

      UIFlow, so easy an adult can learn it!
      If I don't know it, be patient!
      I've ether not learned it or am too drunk to remember it!
      Author of the WIP UIFlow Handbook!
      M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

      m5-docsM 1 Reply Last reply Reply Quote 0
      • m5-docsM
        m5-docs @ajb2k3
        last edited by

        @ajb2k3
        Expect

        M5Stack documentation URL

        https://docs.m5stack.com

        ajb2k3A 1 Reply Last reply Reply Quote 0
        • ajb2k3A
          ajb2k3 @m5-docs
          last edited by

          @watson huh?

          UIFlow, so easy an adult can learn it!
          If I don't know it, be patient!
          I've ether not learned it or am too drunk to remember it!
          Author of the WIP UIFlow Handbook!
          M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post