Пример #1
0
	def checkHit(self):
		hitbox = (self.pos[0]+(self.dir*(_g['scale']*6)),self.pos[1]+_g['scale'])		#We only use a point for arrows, because only the point is fatal
		if (self.team == 0):															#If the enemies shot it, only check to see if it hit the player by referencing it.
			if (gfuncs.isWithin(hitbox, _g['player'].pos)):
				_g['player'].alive = False
				self.alive = False
		else:																			#Otherwise, go through every object.
			for obj in _g['game'].objects:												#Note: Player shot projectiles can stop enemy ones!
				if (obj != _g['player'] and obj != self):
					if (gfuncs.isWithin(hitbox, obj.pos)):
						obj.hp -= 1
						if (obj.hp <= 1):
							obj.alive = False
						self.alive = False
						break
Пример #2
0
	def checkHit(self):	#Check to see if we're colliding with the player.
		if (gfuncs.isWithin(self.pos, _g['player'].pos) or gfuncs.isWithin((self.pos[0]+self.pos[2],self.pos[1]), _g['player'].pos) or gfuncs.isWithin((self.pos[0]+self.pos[2],self.pos[1]+self.pos[3]), _g['player'].pos) or gfuncs.isWithin((self.pos[0],self.pos[1]+self.pos[3]), _g['player'].pos)):
			_g['player'].alive = False	#If so, kill him, because he only has 1 life.