[英]How can I make the player go forward? (Ursina Python)
class Player(Entity):
def __init__(self):
self.controller = Entity(
model = 'cube',
parent = camera
)
super().__init__(parent=self.controller)
def update(self):
if held_keys['a']:
camera.rotation_y -= 50 * time.dt
self.controller.rotation_y = camera.rotation_y
if camera.rotation_y < -360: camera.rotation_y = 0
if held_keys['d']:
camera.rotation_y += 50 * time.dt
self.controller.rotation_y = camera.rotation_y
if camera.rotation_y > 360: camera.rotation_y = 0
entity = Entity(model='cube')
def update():
entity.position += entity.forward
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.