class Game(): def __init__(self): self.app = Ursina() window.fullscreen = True self.word = World() self.player = Player() self.sky = Sky() self.app.run()
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(): print('turn:', on_off_switch.value) on_off_switch.on_value_changed = on_value_changed window.color = color._32 app.run()
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': a.fade_out(duration=4, curve=curve.linear) base.run()
# 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.