SHARE
TWEET

Untitled

a guest May 23rd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if not keyboard.is_pressed('w') and not keyboard.is_pressed('s') and not keyboard.is_pressed('a') and not keyboard.is_pressed('d'):
  2.                 self.setMotorSpeed(0, 0)
  3.                 self.speed = 0
  4.  
  5.             if keyboard.is_pressed('w'):
  6.                 self.speed = 0.5
  7.                 self.setMotorSpeed(self.speed, self.speed)
  8.                 self.isPressedkey = 1
  9.             else:
  10.                 if not self.isPressedkey:
  11.                     self.speed = 0
  12.                     self.setMotorSpeed(self.speed, self.speed)
  13.                     self.isPressedkey = 0
  14.  
  15.             if keyboard.is_pressed('a'):
  16.                 self.setMotorSpeed(self.speed - 0.2, self.speed + 0.2)
  17.                 self.isPressedkey = 1
  18.             else:
  19.                 if not self.isPressedkey:
  20.                     self.setMotorSpeed(0, 0)
  21.                     self.isPressedkey = 0
  22.  
  23.             if keyboard.is_pressed('d'):
  24.                 self.setMotorSpeed(self.speed + 0.2, self.speed - 0.2)
  25.                 self.isPressedkey = 1
  26.             else:
  27.                 if not self.isPressedkey:
  28.                     self.setMotorSpeed(0, 0)
  29.                     self.isPressedkey = 0
  30.  
  31.             if keyboard.is_pressed('s'):
  32.                 self.speed = -0.5
  33.                 self.setMotorSpeed(self.speed, self.speed)
  34.                 self.isPressedkey = 1
  35.             else:
  36.                 if not self.isPressedkey:
  37.                     self.speed = 0
  38.                     self.setMotorSpeed(self.speed, self.speed)
  39.                     self.isPressedkey = 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top