laneya

multiplayer roguelike game
git clone https://git.ce9e.org/laneya.git

commit
7136188c7f7ef11ebd46afc490d070b39551539c
parent
5eab349dc3be9901181021a0a2487a39a87cee27
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-10-05 10:03
move example in client

Diffstat

M laneya/client.py 9 +++++++++

1 files changed, 9 insertions, 0 deletions


diff --git a/laneya/client.py b/laneya/client.py

@@ -17,6 +17,9 @@ class ClientProtocol(protocol.ClientProtocol):
   17    17     def updateReceived(self, action, **kwargs):  # TODO
   18    18         print(action, kwargs)
   19    19 
   -1    20     def move(self, direction):
   -1    21         return self.sendRequest('move', direction=direction)
   -1    22 
   20    23 
   21    24 def connected(protocol):  # TODO
   22    25     protocol.setup('testuser')
@@ -27,6 +30,12 @@ def connected(protocol):  # TODO
   27    30     protocol.sendRequest('other', foo='bar')\
   28    31         .then(_print, log.err)
   29    32 
   -1    33     protocol.move('south')
   -1    34     reactor.callLater(2, lambda: protocol.move('west'))
   -1    35     reactor.callLater(4, lambda: protocol.move('north'))
   -1    36     reactor.callLater(6, lambda: protocol.move('east'))
   -1    37     reactor.callLater(8, lambda: protocol.move('stop'))
   -1    38 
   30    39 
   31    40 def main():
   32    41     log.startLogging(sys.stdout)