Код: Выделить всё
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina()
player = FirstPersonController()
Sky()
boxes = []
def add_box(position):
boxes.append(
Button(
parent=scene,
model="cube",
origin=0.5,
color="green",
position=position,
texture="grass"
)
)
def add_box_wood(position):
boxes.append(
Button(
parent=scene,
model="cube",
origin=0.5,
color="brown",
position=position,
texture='texture/wood.jpg'
)
)
for x in range(20):
for y in range(20):
add_box( (x, -4, y) )
def input(key):
for box in boxes:
if box.hovered:
if key == "right mouse down":
add_box_wood(box.position + mouse.normal)
if key == "left mouse down":
boxes.remove(box)
destroy(box)
app.run()