Esempio n. 1
0
def addParticle(x, y, startspeed, img, scale, num,colour=[1,1,1]):
    global particles
    simplenet.sendall("addps", [x, y, startspeed, img, scale, num,colour])
    #if simplenet.isServer:
    #  return
    startspeed = num/25.0
    for i in range(num):
        particles.append(smokeparticle.smokeparticle(x,y,img,scale,startspeed,colour))
Esempio n. 2
0
 def run(self):
     #self.runMenu()
     #self.initNet()
     while 1:
         timer.tick()
         self.doNet()
         for event in pygame.event.get():
             self.handleEvent(event, self.mywalker)
         if not simplenet.isClient:
             self.mainloop()
         particles.update()
         if simplenet.isServer:
             self.drawstuff()
             simplenet.sendall("gamestate", self.gamestate)
         else:
             #particles.update()
             self.drawstuff()
Esempio n. 3
0
def explode(x, y, radius = 50, setto = 0):
    if not destructable: return
    simplenet.sendall("boom", [x, y, radius, setto])
    #game.explode(x, y, radius, setto)
    radp1 = radius+1
    rad2 = radius*radius
    x = int(x)
    y = int(y)
    tilex, tiley = getTile(x, y)

    updatelist(tilex, tiley)

    l = x-radius
    r = x+radp1
    t = y-radius
    b = y+radp1
    if l < 0: l = 0
    if t < 0: t = 0
    if b >= y2-1: b = y2-2
    if r >= x2-1: r = x2-2
    if radius > 6:
        #particles.addParticle(x, y, 0.5, "smoke.png", radius/10, int((radius-5)*0.15+1))
        #particles.addParticle(x, y, 0.5, "fire.png", radius/10, int((radius-5)*0.05+1))
        updaterad(tilex,tiley,radius)
        '''updatelist(tilex+1, tiley+1)
        updatelist(tilex-1, tiley+1)
        updatelist(tilex, tiley+1)
        updatelist(tilex+1, tiley)
        updatelist(tilex-1, tiley)
        updatelist(tilex+1, tiley-1)
        updatelist(tilex, tiley-1)
        updatelist(tilex-1, tiley-1)'''
    for xp in list(range(int(l), int(r))):
        for yp in list(range(int(t), int(b))):
            xd = xp-x
            yd = yp-y
            #if imgalpha[xp][yp] > setto:
            if xd * xd + yd * yd < rad2:
                imgalpha[xp][yp] = setto
Esempio n. 4
0
def pastesurfID(pixID, x, y, ang, scale):
    simplenet.sendall("pastetex", [pixID, x, y, ang, scale])
    pix = pygame.transform.rotozoom(display.lookuppixID(pixID), ang, scale)
    x = x-pix.get_width()/2
    y = y-pix.get_height()/2
    pastesurf(pix, x, y)
Esempio n. 5
0
def addTextParticle(x, y, startspeed, img, scale, colour=[1,1,1]):
    global particles
    simplenet.sendall("addtps", [x, y, startspeed, img, scale, colour])
    #if simplenet.isServer:
    #  return
    particles.append(textparticle.textparticle(x,y,img,scale,1,colour))