Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ursina import *
- from ursina.prefabs.first_person_controller import FirstPersonController
- from random import *
- app = Ursina()
- #create a player
- player = FirstPersonController(collider = 'box', speed = 5)
- #create a floor
- floor = Entity(model = 'plane',
- scale = (100,2,100),
- collider = 'box',
- texture = 'white_cube',
- texture_scale = (50,50),
- color = color.white.tint(-0.2))
- target = Entity(model = 'cube',
- scale = (2,2,2),
- collider = 'box',
- position = (randint(-50,50), 1, randint(-50,50) ),
- color = color.green)
- jumpy_block = Entity(model = 'cube',
- scale = (5,2,5),
- collider = 'box',
- position = (-20,1,20),
- color = color.pink)
- def update():
- hit_info = player.intersects()
- if hit_info.hit:
- if hit_info.entity == jumpy_block:
- player.jump_height = 50
- player.speed = 50
- else:
- player.jump_height = 2
- player.speed = 5
- if hit_info.entity == target:
- message = Text(text = 'YOU WIN', origin = (0,0), background = True, color = color.green)
- mouse.locked = False
- application.pause()
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement