changeset 72:d7875b63f525

Set up client recieving score
author Michael Rochseter <m.rochester93@googlemail.com>
date Sun, 08 Jul 2012 11:42:52 +0200
parents 3f1b3699faf2
children 840af9aa4193
files zrpn/client.py
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/zrpn/client.py	Sun Jul 08 11:35:52 2012 +0200
+++ b/zrpn/client.py	Sun Jul 08 11:42:52 2012 +0200
@@ -21,8 +21,8 @@
         self.client = net.Client()
         self.connection = self.client.connect(address, port)
         self.lbl_time=sgc.Label(pos=(0,0),text="time\nwasted=\n0") 
-        self.lbl_score=sgc.Label(pos=(0,70),text="score=0") 
-        self.lbl_highscore = sgc.Label(pos=(0,100),text="First=0")    
+        self.lbl_score=sgc.Label(pos=(0,70),text="score=\n0") 
+        self.lbl_highscore = sgc.Label(pos=(0,120),text="First=\n0")    
 
         w=[self.lbl_time,self.lbl_score,self.lbl_highscore]
   
@@ -46,12 +46,12 @@
                                     event.packet.sprites)
                         elif event.p_type == packets.ANIMATIONS:
                             self.display.do_animations(event.packet.animations)
+                        elif event.p_type == packets.SCORE:
+                            self.lbl_score.config(text="score=\n"+str(event.packet.score_num))
+                            self.lbl_highscore.config(text="first=\n"+str(event.packet.highscore))
             self.client.step()
             t = time.time() - self.start
-            self.lbl_time.config(text="time\nwasted=\n"+str(t))
-
-            self.x=self.x+1
-            self.lbl_score.config(text="score="+str(self.x))
+            self.lbl_time.config(text="time\nwasted=\n"+str(round(t,5)))
             self.display.frame()