Пример #1
0
 def finalHitLand(self):
     self.dead = 1
     myangle = atan2(-self.xvel, -self.yvel)/3.141573*180.0
     self.movesleft = 0
     xpos = self.x-self.xn*6
     ypos = self.y-self.yn*6
     terrain.pastesurfID(self.pix, xpos, ypos, myangle, 0.5)
Пример #2
0
 def movDone(self,x1,y1,x2,y2):
     particles.addParticle(self.x, self.y, 0.5, "smoke.png", 2.5, 1,[0.7,0.7,0.4])
     if self.vel < 14:
       self.xvel*=1.1
       self.yvel*=1.1
     if self.vel > 15:
       self.xvel*=0.9
       self.yvel*=0.9
     myangle = atan2(-self.xvel, -self.yvel)/3.141573*180.0
     if self.xvel<0:
         myangle+=180
     xpos = self.x-self.xn*6
     ypos = self.y-self.yn*6
     terrain.pastesurfID(self.pix, x1, y1+2, myangle, 0.6)
Пример #3
0
 def doNet(self):
     #if isServer:
     #	checktimeouts()
     while simplenet.checkdata():
         packet, peer = simplenet.nextpacket()
         if packet is None: break
         pType = packet[0]
         pData = packet[1]
         #print pType, pData
         if simplenet.isServer:
             cl = self.findclient(peer)
             if cl != None: cl.lastpackettime = 0
             if pType=="join":
                 cl = self.addClient(pData, peer)
                 if cl is None:
                     simplenet.sendto("joinfailed", "alreadyjoined?", peer)
                 else:
                     simplenet.sendto("yourein", "dosomethingcool", peer)
             elif cl is None:
                 simplenet.sendto("whoyou", "i didnt get join message", peer)
             elif pType == "event":
                 self.handleEvent(pData, cl)
         else:#client
             if pType=="gamestate":
                 self.gamestate = pData
                 self.clients = self.gamestate.clients
                 self.walkers = self.clients
                 for w in range(len(self.walkers)):
                     if self.walkers[w].name == self.name:
                         self.mywalker = self.walkers[w]
             elif pType=="boom":
                 terrain.explode(pData[0], pData[1], pData[2], pData[3])
             elif pType=="pastetex":
                 terrain.pastesurfID(pData[0], pData[1], pData[2], pData[3], pData[4])
             elif pType=="addtps":
                 particles.addTextParticle(pData[0], pData[1], pData[2], pData[3], pData[4], pData[5])
             elif pType=="addps":
                 particles.addParticle(pData[0], pData[1], pData[2], pData[3], pData[4], pData[5], pData[6])
                 #print pData
             elif pType=="msg":
                 #addmsg(pData[0], pData[1])
                 print(pData)
             elif pType=="whoyou":
                 simplenet.sendserv("join", self.name)
             elif pType=="wakeup":
                 simplenet.sendserv("keepalive", "dude")