-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathMinecraftUnder40Lines.py
More file actions
38 lines (31 loc) · 1.07 KB
/
MinecraftUnder40Lines.py
File metadata and controls
38 lines (31 loc) · 1.07 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
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
app = Ursina()
Sky(texture='sky_sunset')
player = FirstPersonController()
sword = Entity(model='assets\\blade', texture='assets\sword', rotation=(30,-40),
position=(0.6,-0.6), parent=camera.ui, scale=(0.2,0.15))
def update():
if held_keys['left mouse']:
sword.position = (0.6,-0.5)
elif held_keys['right mouse']:
sword.position = (0.6,-0.5)
else:
sword.position = (0.7,-0.6)
boxes = []
for n in range(12):
for k in range(12):
box = Button(color=color.white, model='cube', position=(k,0,n),
texture='assets\grass',parent=scene, origin_y=0.5)
boxes.append(box)
def input(key):
for box in boxes:
if box.hovered:
if key == 'left mouse down':
new = Button(color=color.white, model='cube',position= box.position + mouse.normal,
texture='assets\grass', parent=scene, origin_y=0.5)
boxes.append(new)
if key == 'right mouse down':
boxes.remove(box)
destroy(box)
app.run()