ahmed0saber

on key held in Python

May 7th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. from ursina import *
  2. from random import randint
  3.  
  4. def update():
  5.     if held_keys['a']:
  6.         cube.rotation_y+=time.dt*100
  7.     if held_keys['d']:
  8.         cube.rotation_y-=time.dt*100
  9.     if held_keys['w']:
  10.         cube.rotation_x+=time.dt*100
  11.     if held_keys['s']:
  12.         cube.rotation_x-=time.dt*100
  13.  
  14. app=Ursina()
  15.  
  16. cube=Entity(model="cube",color=color.blue,texture="white_cube")
  17. app.run()
Advertisement
Add Comment
Please, Sign In to add comment