Skip to content

Commit

Permalink
classe du keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Rannn00 committed May 11, 2022
1 parent 9f75b29 commit 5821e8b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions srcs/simulation/controller/keyevent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from .controller import *
from simulation import config
import keyboard
import time
from threading import Thread



def launchkeyevent(proxy,stratseqs):
Dist_thread =Thread(target=readkeys,args=(proxy,stratseqs))
Dist_thread.start()

def readkeys (proxy,stratseqs):
events = keyboard.record('esc')
if keyboard.read_key() == "up arrow":
print(b)
stratseqs.append(moveForwardStrategy(proxy,20,50))
if keyboard.read_key() == "down arrow":
stratseqs.append(moveForwardStrategy(proxy,20,-50))
if keyboard.read_key() == "left arrow":
stratseqs.append(TurnStrategy(proxy,5,20))
if keyboard.read_key() == "right arrow":
stratseqs.append(TurnStrategy(proxy,-5,20))
sleep(2)
#stratseqs.append(strat)


0 comments on commit 5821e8b

Please sign in to comment.