-
Notifications
You must be signed in to change notification settings - Fork 3
/
tekken.py
68 lines (50 loc) · 1.37 KB
/
tekken.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import xboxkeymap as xbox
import logger
app_logger = logger.getLogger(printToScreen=True)
class Fighter:
def __init__(self, name):
self.Name = name
app_logger.debug( "Fighter initialzed %s", self._getLogCtx())
def _getLogCtx(self):
return {"Name": self.Name}
def leftPunch(self):
xbox.pressX()
app_logger.info( self._getLogCtx())
def rightPunch(self):
xbox.pressY()
app_logger.info( self._getLogCtx())
def leftKick(self):
xbox.pressA()
app_logger.info( self._getLogCtx())
def rightKick(self):
xbox.pressB()
app_logger.info( self._getLogCtx())
def jump(self):
xbox.pressLJoyUp()
app_logger.info( self._getLogCtx())
def crouch(self):
xbox.pressLJoyDown()
app_logger.info( self._getLogCtx())
def moveFront(self):
xbox.pressLJoyRight()
app_logger.info( self._getLogCtx())
def moveBack(self):
xbox.pressLJoyLeft()
app_logger.info( self._getLogCtx())
def action():
fighter = Fighter("Law")
fighter.leftPunch()
fighter.rightPunch()
fighter.leftKick()
fighter.rightKick()
fighter.jump()
fighter.crouch()
fighter.moveFront()
fighter.moveBack()
def fight():
while True:
action()
def main():
fight()
if __name__ == '__main__':
main()