Exemplo n.º 1
0
 def __init__(self):
     self.app = Ursina()
     window.fullscreen = True
     self.word = World()
     self.player = Player()
     self.sky = Sky()
     self.app.run()
Exemplo n.º 2
0
                self.selected[0].color = self.deselected_color
                self.selected.pop(0)
        # remove
        else:
            b.color = self.deselected_color
            self.selected.remove(b)

        self.on_value_changed()

    def on_value_changed(self):
        pass


if __name__ == '__main__':
    from ursina import Ursina
    app = Ursina()

    # Text.default_font = 'VeraMono.ttf'
    gender_selection = ButtonGroup(('man', 'woman', 'other'))
    on_off_switch = ButtonGroup(('off', 'on'),
                                min_selection=1,
                                y=-.1,
                                default='on',
                                selected_color=color.red)

    def on_value_changed():
        print('set gender:', gender_selection.value)

    gender_selection.on_value_changed = on_value_changed

    def on_value_changed():
Exemplo n.º 3
0
        else:
            self.animate('volume',
                         value,
                         duration=duration,
                         delay=delay,
                         curve=curve,
                         resolution=resolution,
                         interrupt=interrupt)
        if destroy_on_ended:
            _destroy(self, delay=duration + .01)


if __name__ == '__main__':
    from ursina import Ursina, printvar

    base = Ursina()
    # a = Audio('life_is_currency_wav', pitch=1)
    a = Audio('life_is_currency', pitch=1, loop=True, autoplay=True)

    # print(a.recipe)
    # a2 = Audio(clip=a.clip)
    # a2 = duplicate(a)
    # a2.clip = a.clip
    # a2.play()
    # print(a2.clip)
    # a.fade_out(delay=1)
    # DebugMenu(a)


    def input(key):
        if key == 'f':
Exemplo n.º 4
0
''',
default_input={
    'texture_scale' : Vec2(1,1),
    'texture_offset' : Vec2(0.0, 0.0),
    'position_offsets' : [Vec3(i,0,0) for i in range(256)],
    'rotation_offsets' : [Vec4(0) for i in range(256)],
    'scale_multipliers' : [Vec3(1) for i in range(256)],
}
)



if __name__ == '__main__':
    from ursina import Ursina, Entity, EditorCamera, Vec3, color, application, time, Cone
    import random
    app = Ursina(vsync=False)

    instances = []
    Entity(model='plane', texture='grass', scale=128)
    application.asset_folder = application.asset_folder.parent.parent
    p = Entity(model=Cone(5), y=1, texture='brick')
    p.model.uvs = [(v[0],v[1]) for v in p.model.vertices]
    p.model.generate()
    p.shader = instancing_shader
    p.setInstanceCount(256)

    for z in range(16):
        for x in range(16):
            e = Entity(position=Vec3(x, 0, z), color=color.lime, rotation_y=random.random()*360)
            instances.append(e)
            print(e.quaternion, Quat())
Exemplo n.º 5
0
# Taken from https://www.ursinaengine.org/
from ursina import Entity, Ursina, color, held_keys

app = Ursina()

player = Entity(model="cube", color=color.orange, scale_y=2)


def update():  # update gets automatically called.
    player.x += held_keys["d"] * 0.1
    player.x -= held_keys["a"] * 0.1


app.run()  # opens a window and starts the game.