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
- app = Ursina()
- #Build a floor
- floor = Entity(collider = 'box',
- model = 'plane',
- scale = (100,1,100),
- color = color.white.tint(-0.1),
- texture = 'white_cube',
- texture_scale = (100,100))
- #Create a First person controller (player)
- player = FirstPersonController(model ='cube', collider = 'box')
- #LISTS:
- bullets = []
- def update():
- for b in bullets:
- b.position += b.forward
- #spawn bullets when we press left mouse
- def input(key):
- if key == 'left mouse down':
- bullet = Entity(model = 'cube',
- collider = 'box',
- scale = (0.2,0.2,0.2),
- color = color.green,
- position = player.position)
- bullets.append(bullet)
- #your task is to modify bullet to be elongated int the right direction
- if key == 'c':
- application.pause()
- mouse.locked = False
- app.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement