ahmed0saber

Randomly changing color of cube in Python

May 7th, 2021
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. from ursina import *
  2. from random import randint
  3. import time
  4.  
  5. def update():
  6.     red=randint(0,255)
  7.     green=randint(0,255)
  8.     blue=randint(0,255)
  9.     cube.color=color.rgb(red,green,blue)
  10.     time.sleep(0.2)
  11.  
  12. app=Ursina()
  13. cube=Entity(model="cube",color=color.rgb(0,0,100))
  14. app.run()
Advertisement
Add Comment
Please, Sign In to add comment