Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import stuff
- from ursina import *
- from ursina.prefabs.first_person_controller import FirstPersonController
- app = Ursina()
- #create a player
- player = FirstPersonController(model = 'cube', collider = 'box', jump_height = 2, gravity = 1, speed = 5)
- #create a floor
- floor = Entity(collider = 'box',
- model = 'plane',
- scale = (100,1,100),
- texture = 'white_cube',
- texture_scale = (100,100),
- color = color.white.tint(-0.1))
- #build a target
- target = Entity(model = 'cube',
- collider = 'box',
- scale = (2,2,2),
- color = color.green,
- position = (30,1,30))
- def update():
- hit_info = player.intersects()
- if hit_info.hit:
- if hit_info.entity == target:
- player.jump_height = 20
- player.gravity = 0.1
- else:
- player.jump_height = 2
- player.gravity = 1
- if held_keys['c']:
- application.pause()
- mouse.locked = False
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement