-
Notifications
You must be signed in to change notification settings - Fork 171
/
Copy pathursina_intro.py
54 lines (42 loc) · 1.12 KB
/
ursina_intro.py
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
43
44
45
46
47
48
49
50
51
52
53
54
from ursina import *
# Test Cube
class Test_cube(Entity):
def __init__(self):
super().__init__(
parent = scene,
model = 'cube',
texture = 'white_cube',
rotation = Vec3(45,45,45))
# Test button
class Test_button(Button):
def __init__(self,scale = 0.1):
super().__init__(
parent = scene,
model = 'cube',
texture = 'brick',
color = color.white,
highlight_color = color.red,
pressed_color = color.lime)
def input(self,key):
if self.hovered:
if key == 'left mouse down':
punch_sound.play()
# update is run every frame
def update():
#print('test')
if held_keys['a']:
cube.x -= 1 * time.dt
# basic window
app = Ursina()
# basic cube
cube = Entity(model='quad', color=color.orange, scale = (2,5), position = (5,1))
# quad with texture
#sans_image = load_texture('Sans.png')
#sans = Entity(model = 'quad', texture = sans_image)
#sans = Entity(model = 'quad', texture = 'Sans.png')
# creating a block properly
test = Test_cube()
# creating a button
btn = Test_button()
punch_sound = Audio('assets/punch', loop=False, autoplay=False)
app.run()