Sanjin1

Untitled

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