Ejemplo n.º 1
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     pos = [[
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ], TILESIZE]
     from Code.Engine.Terrain import getTileSubsurface
     if PTRS["EDITORMODE"]:
         pic = self.previewTrap()
     elif self.timer >= 30:
         if (not GetTerrain(self.floor).canMoveThrough(
             (self.source[0] - 1, self.source[1]), True)):
             x = 2
             y = 1
         elif (not GetTerrain(self.floor).canMoveThrough(
             (self.source[0], self.source[1] - 1), True)):
             x = 1
             y = 1
         elif (not GetTerrain(self.floor).canMoveThrough(
             (self.source[0], self.source[1] + 1), True)):
             x = 2
             y = 2
         else:
             x = 1
             y = 2
         if self.timer <= 40 or self.timer > 48:
             x += 2
         pic = getTileSubsurface("Traps", x, y)
     else:
         pic = getTileSubsurface("Traps", 0, 0)
     camera.getSurface().blit(pic, pos)
Ejemplo n.º 2
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     variation = self.getVariation()
     pos = [
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ]
     from Code.Engine.Terrain import getTileSubsurface
     if self.activated or self.unitHasKey:
         if PTRS["EDITORMODE"]:
             pic = getTileSubsurface("Traps", 1, 0)
         else:
             pic = getTileSubsurface("Traps", 0, 0)
     else:
         pic = getTileSubsurface("Traps", 0, 1 + variation)
     camera.getSurface().blit(pic, pos)
     if self.key != 0 and (PTRS["EDITORMODE"]
                           or not self.activated and not self.unitHasKey):
         pos = [
             pos[0] + TILESIZE[0] / 2 - lockPics.get_width() / 2,
             pos[1] + TILESIZE[1] / 2 - lockPics.get_width() / 2
         ]
         pic = lockPics.subsurface(
             ((0, (self.key - 1) * lockPics.get_width()),
              (lockPics.get_width(), lockPics.get_width())))
         camera.getSurface().blit(pic, pos)
Ejemplo n.º 3
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		pos = [self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()]
		from Code.Engine.Terrain import getTileSubsurface
		if self.direction == Directions.UP:
			pic = getTileSubsurface("Traps", 7, 0)
		else:
			pic = getTileSubsurface("Traps", 8, 0)
		camera.getSurface().blit(pic, pos)
		if 0 < self.timer <= self.maxTime:
			pygame.draw.rect(camera.getSurface(), [255, 255, 0], [pos, [max(int(TILESIZE[0] * self.timer / float(self.maxTime)), 1), 4]])
			pygame.draw.rect(camera.getSurface(), [255] * 3, [pos, [TILESIZE[0], 4]], 1)
Ejemplo n.º 4
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		variation = 0
		pos = [[self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()], TILESIZE]
		from Code.Engine.Terrain import getTileSubsurface, tilesetLookup
		if PTRS["EDITORMODE"]:
			pic = self.previewTrap()
		elif not self.activated:
			tileset = tilesetLookup(GetTerrain(self.floor).getAtCoord((self.source[0], self.source[1]), 0))
			pic = getTileSubsurface(tileset, 1, 0)
		else:
			pic = getTileSubsurface("Traps", 0, 0)
		camera.getSurface().blit(pic, pos)
Ejemplo n.º 5
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		pos = [self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()]
		from Code.Engine.Terrain import getTileSubsurface
		if PTRS["EDITORMODE"]:
			pic = self.previewTrap()
		elif self.open[0] < self.open[1]:
			pic = getTileSubsurface("Traps", 6 + self.type, 1)
		else:
			pic = getTileSubsurface("Traps", 6 + self.type, 2)
		camera.getSurface().blit(pic, pos)
		if 0 < self.open[0] < self.open[1]:
			pygame.draw.rect(camera.getSurface(), [255, 255, 0], [pos, [int(TILESIZE[0] * self.open[0] / float(self.open[1])), 4]])
			pygame.draw.rect(camera.getSurface(), [255] * 3, [pos, [TILESIZE[0], 4]], 1)
Ejemplo n.º 6
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		from Code.Engine.Terrain import getTileSubsurface
		pos = [self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()]
		pic = getTileSubsurface(self.FileName, self.shrineX, self.shrineY)
		camera.getSurface().blit(pic, pos)
Ejemplo n.º 7
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		pos = [[self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()], TILESIZE]
		from Code.Engine.Terrain import getTileSubsurface
		pic = None
		if PTRS["EDITORMODE"]:
			pic = self.previewTrap()
		elif self.timer >= 35:
			x = 4; y = 0;
			if self.timer <= 42 or self.timer > 48:
				x = 3; y = 0;
			pic = getTileSubsurface("Traps", x, y)
		elif self.wasDetected:
			pic = getTileSubsurface("Traps", 2, 0)
		if pic:
			camera.getSurface().blit(pic, pos)
Ejemplo n.º 8
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		variation = self.getVariation()
		pos = [self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()]
		from Code.Engine.Terrain import getTileSubsurface
		if self.activated or self.unitHasKey:
			if PTRS["EDITORMODE"]:
				pic = getTileSubsurface("Traps", 1, 0)
			else:
				pic = getTileSubsurface("Traps", 0, 0)
		else:
			pic = getTileSubsurface("Traps", 0, 1 + variation)
		camera.getSurface().blit(pic, pos)
		if self.key != 0 and (PTRS["EDITORMODE"] or not self.activated and not self.unitHasKey):
			pos = [pos[0] + TILESIZE[0] / 2 - lockPics.get_width() / 2, 
						 pos[1] + TILESIZE[1] /2 - lockPics.get_width() / 2]
			pic = lockPics.subsurface(((0, (self.key - 1) * lockPics.get_width()), (lockPics.get_width(), lockPics.get_width())))
			camera.getSurface().blit(pic, pos)
Ejemplo n.º 9
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     variation = 0
     pos = [[
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ], TILESIZE]
     from Code.Engine.Terrain import getTileSubsurface, tilesetLookup
     if PTRS["EDITORMODE"]:
         pic = self.previewTrap()
     elif not self.activated:
         tileset = tilesetLookup(
             GetTerrain(self.floor).getAtCoord(
                 (self.source[0], self.source[1]), 0))
         pic = getTileSubsurface(tileset, 1, 0)
     else:
         pic = getTileSubsurface("Traps", 0, 0)
     camera.getSurface().blit(pic, pos)
Ejemplo n.º 10
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     from Code.Engine.Terrain import getTileSubsurface
     pos = [
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ]
     pic = getTileSubsurface(self.FileName, self.shrineX, self.shrineY)
     camera.getSurface().blit(pic, pos)
Ejemplo n.º 11
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     pos = [
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ]
     from Code.Engine.Terrain import getTileSubsurface
     if PTRS["EDITORMODE"]:
         pic = self.previewTrap()
     elif self.open[0] < self.open[1]:
         pic = getTileSubsurface("Traps", 6 + self.type, 1)
     else:
         pic = getTileSubsurface("Traps", 6 + self.type, 2)
     camera.getSurface().blit(pic, pos)
     if 0 < self.open[0] < self.open[1]:
         pygame.draw.rect(camera.getSurface(), [255, 255, 0], [
             pos,
             [int(TILESIZE[0] * self.open[0] / float(self.open[1])), 4]
         ])
         pygame.draw.rect(camera.getSurface(), [255] * 3,
                          [pos, [TILESIZE[0], 4]], 1)
Ejemplo n.º 12
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     pos = [[
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ], TILESIZE]
     from Code.Engine.Terrain import getTileSubsurface
     pic = None
     if PTRS["EDITORMODE"]:
         pic = self.previewTrap()
     elif self.timer >= 35:
         x = 4
         y = 0
         if self.timer <= 42 or self.timer > 48:
             x = 3
             y = 0
         pic = getTileSubsurface("Traps", x, y)
     elif self.wasDetected:
         pic = getTileSubsurface("Traps", 2, 0)
     if pic:
         camera.getSurface().blit(pic, pos)
Ejemplo n.º 13
0
	def drawMe(self, camera):
		if camera.floor != self.floor:
			return
		pos = [[self.source[0] * TILESIZE[0] - camera.Left(), self.source[1] * TILESIZE[1] - camera.Top()], TILESIZE]
		from Code.Engine.Terrain import getTileSubsurface
		if PTRS["EDITORMODE"]:
			pic = self.previewTrap()
		elif self.timer >= 30:
			if (not GetTerrain(self.floor).canMoveThrough((self.source[0] - 1, self.source[1]), True)):
				x = 2; y = 1;
			elif (not GetTerrain(self.floor).canMoveThrough((self.source[0], self.source[1] - 1), True)):
				x = 1; y = 1;
			elif (not GetTerrain(self.floor).canMoveThrough((self.source[0], self.source[1] + 1), True)):
				x = 2; y = 2;
			else:
				x = 1; y = 2;
			if self.timer <= 40 or self.timer > 48:
				x += 2
			pic = getTileSubsurface("Traps", x, y)
		else:
			pic = getTileSubsurface("Traps", 0, 0)
		camera.getSurface().blit(pic, pos)
Ejemplo n.º 14
0
 def drawMe(self, camera):
     if camera.floor != self.floor:
         return
     pos = [
         self.source[0] * TILESIZE[0] - camera.Left(),
         self.source[1] * TILESIZE[1] - camera.Top()
     ]
     from Code.Engine.Terrain import getTileSubsurface
     if self.direction == Directions.UP:
         pic = getTileSubsurface("Traps", 7, 0)
     else:
         pic = getTileSubsurface("Traps", 8, 0)
     camera.getSurface().blit(pic, pos)
     if 0 < self.timer <= self.maxTime:
         pygame.draw.rect(camera.getSurface(), [255, 255, 0], [
             pos,
             [
                 max(int(TILESIZE[0] * self.timer / float(self.maxTime)),
                     1), 4
             ]
         ])
         pygame.draw.rect(camera.getSurface(), [255] * 3,
                          [pos, [TILESIZE[0], 4]], 1)
Ejemplo n.º 15
0
 def previewTrap(self):
     from Code.Engine.Terrain import getTileSubsurface
     return getTileSubsurface("Traps", 5, 0)
Ejemplo n.º 16
0
	def previewTrap(self):
		from Code.Engine.Terrain import getTileSubsurface, tilesetLookup
		return getTileSubsurface("Traps", 6, 0)
Ejemplo n.º 17
0
 def previewTrap(self):
     from Code.Engine.Terrain import getTileSubsurface, tilesetLookup
     return getTileSubsurface("Traps", 6, 0)
Ejemplo n.º 18
0
	def previewTrap(self):
		from Code.Engine.Terrain import getTileSubsurface
		return getTileSubsurface("Traps", 5, 0)