Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class wall():
- def __init__(self, x, y, dim, c, screen):
- self.x = x
- self.y = y
- self.dim = dim
- self.color = c
- self.screen = screen
- self.rect = (x, y, dim[0], dim[1])
- def affiche(self):
- pygame.draw.rect(self.screen,self.color,((self.x,self.y),self.dim))
- self.rect = (self.x,self.y,self.dim[0],self.dim[1])
- def colision(self, onfloorlist, p):
- p.onfloor = False
- entrex = p.x + p.scale[0] >= self.x + p.speed and p.x <= self.x + self.dim[0] - p.speed
- if entrex and p.y + p.scale[1] + p.gactual >= self.y and p.y <= self.y + int(self.dim[1]/2):
- p.y = self.y - p.scale[1]
- if p is current.p1:
- p.lastgactual = p.gactual
- p.gactual = p.g
- p.airtime = 0
- onfloorlist.append(1)
- elif entrex and p.y <= self.y + self.dim[1] and p.y + p.scale[1] >= int(self.dim[1]/2) + self.y:
- p.y = self.y + self.dim[1]
- onfloorlist.append(0)
- p.gm = p.g
- p.gactual = p.g
- entrey = p.y + p.scale[1] >= self.y + (p.g + 1) and p.y <= self.y + self.dim[1] - (p.g + 1)
- if entrey and p.x + p.scale[0] >= self.x - p.speed and p.x + p.scale[0] <= int(self.dim[0]/2) + self.x:
- p.x -= p.speed
- onfloorlist.append(0)
- elif entrey and p.x <= self.x + self.dim[0] and p.x + p.scale[0] >= int(self.dim[0]/2) + self.x:
- p.x += p.speed
- onfloorlist.append(0)
- return onfloorlist
- def loop(lst):
- for j in current.mobs + current.p1.invoc + [current.p1]:
- onfloorlist = []
- for i in lst:
- wall.affiche(i)
- onfloorlist = wall.colision(i, onfloorlist, j)
- j.onfloor = bool(onfloorlist)
- class boost():
- def __init__(self,x,y,dim,color,type):
- self.x = x
- self.y = y
- self.dim = dim
- self.type = type
- self.rect = (self.x,self.y,self.dim[0],self.dim[1])
- self.present = True
- self.color = color
- self.yh = self.y - 6
- self.xh = self.x
- self.dimh = (self.dim[0]-16,self.dim[1]-16)
- self.vh = 1
- self.image = pygame.transform.scale(pygame.image.load("texture\\evr\\boost\\" + self.type + ".png"),self.dimh)
- def blit(self):
- pygame.draw.rect(fen1,self.color,((self.x,self.y+self.dim[1]-6),(self.dim[0],6)))
- if self.present:
- fen1.blit(self.image,(self.xh+8,self.yh))
- def repop(self):
- if self.time + 20 <= time.clock():
- self.present = True
- def animation(self):
- self.xh = self.x
- self.yh += self.vh
- if self.yh + self.dimh[1] >= self.y + self.dim[1] - 10 or self.yh <= self.y - 6:
- self.vh *= -1
- def imageGet(self):
- if self.type == 'heal':
- self.image = pygame.transform.scale(pygame.image.load('texture\\evr\\boost\\heal.png'),self.dimh)
- elif self.type == 'speed':
- self.image = pygame.transform.scale(pygame.image.load('texture\\evr\\boost\\speed.png'),self.dimh)
- def action(self):
- if colision(current.p1.rect, self.rect):
- current.p1.y -= 6
- if self.type == 'heal' and self.present:
- self.present = False
- self.time = time.clock()
- player.modiflife(current.p1,500)
- elif self.type == 'speed' and self.present:
- self.present = False
- self.time = time.clock()
- current.p1.action.append(('speed',5*60))
- current.p1.speed += 5
- def loop(lst):
- for i in lst:
- try:
- boost.repop(i)
- except:
- pass
- i.rect = (i.x,i.y,i.dim[0],i.dim[1])
- boost.action(i)
- boost.animation(i)
- boost.blit(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement