Advertisement
Sanjin1

Untitled

Sep 28th, 2021
1,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. from ursina import *
  2. from ursina.prefabs.first_person_controller import FirstPersonController
  3.  
  4. app = Ursina()
  5.  
  6. #Build a floor
  7. floor = Entity(collider = 'box',
  8.                model = 'plane',
  9.                scale = (100,1,100),
  10.                color = color.white.tint(-0.1),
  11.                texture = 'white_cube',
  12.                texture_scale = (100,100))
  13. #Create a First person controller (player)
  14. player = FirstPersonController(model ='cube', collider = 'box')
  15.  
  16. #LISTS:
  17. bullets = []
  18.  
  19. def update():
  20.     for b in bullets:
  21.         b.position += b.forward
  22.        
  23.  
  24.  
  25. #spawn bullets when we press left mouse
  26. def input(key):
  27.     if key == 'left mouse down':
  28.         bullet = Entity(model = 'cube',
  29.                         collider = 'box',
  30.                         scale = (0.2,0.2,0.2),
  31.                         color = color.green,
  32.                         position = player.position)
  33.         bullets.append(bullet)
  34.        #your task is to modify bullet to be elongated int the right direction
  35.     if key == 'c':
  36.         application.pause()
  37.         mouse.locked = False
  38.  
  39.  
  40. app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement