-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMine_Clone.py
More file actions
42 lines (30 loc) · 1.3 KB
/
Mine_Clone.py
File metadata and controls
42 lines (30 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# This is just the foundation program for Minecraft, no texture nor models are included just the working of placing and destroying blocks.
# Minecraft is a sandbox game, Developed by Mojang. It's a 3D game, where you are in a cubic world, just squares everywhere.
# This Minecraft Clone was made using Ursina Engine, a python game developing library.
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina()
# Define a Voxel class.
# By setting the parent to scene and the model to 'cube' it becomes a 3d button.
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(.9, 1.0)),
highlight_color = color.lime,
)
def input(self, key):
if self.hovered:
if key == 'left mouse down':
voxel = Voxel(position=self.position + mouse.normal)
if key == 'right mouse down':
destroy(self)
for z in range(8):
for x in range(8):
voxel = Voxel(position=(x,0,z))
player = FirstPersonController()
app.run()