Sanjin1

Untitled

Sep 14th, 2021
765
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import stuff
  2. from ursina import *
  3. from ursina.prefabs.first_person_controller import FirstPersonController
  4.  
  5.  
  6. app = Ursina()
  7.  
  8. #create a player
  9. player = FirstPersonController(model = 'cube', collider = 'box', jump_height = 2, gravity = 1, speed = 5)
  10.  
  11. #create a floor
  12. floor = Entity(collider = 'box',
  13.                model = 'plane',
  14.                scale = (100,1,100),
  15.                texture = 'white_cube',
  16.                texture_scale = (100,100),
  17.                color = color.white.tint(-0.1))
  18.  
  19. #build a target
  20. target = Entity(model = 'cube',
  21.                 collider = 'box',
  22.                 scale = (2,2,2),
  23.                 color = color.green,
  24.                 position = (30,1,30))
  25.  
  26.  
  27. def update():
  28.     hit_info = player.intersects()
  29.     if hit_info.hit:
  30.         if hit_info.entity == target:
  31.             player.jump_height = 20
  32.             player.gravity = 0.1
  33.         else:
  34.             player.jump_height = 2
  35.             player.gravity = 1            
  36.            
  37.     if held_keys['c']:
  38.         application.pause()
  39.         mouse.locked = False
  40.  
  41. app.run()
RAW Paste Data