So i have my code and I want to appear a cube under a cube i will click. Then i want to check if there are cubes around this cube if in some place there isnt a cube then create one but i cant do this. Can someone help me?
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina(borderless = False)
player = FirstPersonController(model='none', position=(0,5,0), scale=2)
Sky()
overworld_ground = Entity(
model = 'cube',
scale = (32,2,18),
position = (0,0,0),
collider = 'mesh',
color = color.rgb(0, 128, 0),
texture = 'grass'
)
class Voxel(Button):
def __init__(self, position = (0,0,0)):
super().__init__(
parent = scene,
position = self.position,
model = 'cube',
collider = 'box',
rotation = (0,0,0),
color = color.rgb(0, random.uniform(162,182), 0),
scale = (2, 2, 2))
def input(self, key):
if self.hovered:
if key == 'left mouse down':
voxel = Voxel(self.position.y - 2)
destroy(self)
for z in range(8):
for x in range(8):
voxel = Voxel(position = (x * 2 - 11,-1,z * 2 + 10))
app.run()