Code Minecraft Python
#If you press ` the prosess will close
import sys
import os
import time
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina()
class Voxel(Button):
def __init__(self, position=(0,0,0)):
super().__init__(
parent = scene,
position = position,
model = 'cube',
origin_y = .5,
texture = "white_cube",
color = color.color(0, 0, random.uniform(.9999, 9999.9999)),
)
def input(self, key):
if self.hovered:
if key == 'right mouse down':
voxel = Voxel(position=self.position + mouse.normal)
if key == 'l':
highlight_color = color.lime,
if key == 'b':
highlight_color = color.blue,
if key == '`':
os.system("TASKKILL /F /IM python.exe")
if key == 'left mouse down':
destroy(self)
for z in range(30):
for x in range(30):
voxel = Voxel(position=(x,0,z))
player = FirstPersonController()
app.run()
Selfish Sable