Beispiel #1
0
	def swingSword(self, evt):
		if evt.key == pygame.K_w:
			sword = Weapon('up',self.player.rect.centerx,
						self.player.rect.centery-50,'swadia',40)
			sword.attk(0,1)
			self.sword_count = 5
			self.sword_list.add(sword)
		elif evt.key == pygame.K_a:
			sword = Weapon('left',self.player.rect.centerx-55,
						self.player.rect.centery,'swadia',40)
			sword.attk(-1,0)
			self.sword_count = 5
			self.sword_list.add(sword)
		elif evt.key == pygame.K_s:
			sword = Weapon('down',self.player.rect.centerx,
						self.player.rect.centery+6,'swadia',40)
			sword.attk(0,-1)
			self.sword_count = 5
			self.sword_list.add(sword)
		elif evt.key == pygame.K_d:
			sword = Weapon('right',self.player.rect.centerx+6,
						self.player.rect.centery,'swadia',40)
			sword.attk(1,0)
			self.sword_count = 5
			self.sword_list.add(sword)
Beispiel #2
0
	def weaponAttack(self, evt, rect, nme, spd):
		if evt.key == pygame.K_w:
			weapon = Weapon('up',rect.centerx,rect.centery-10,nme,spd)
			weapon.attk(0,1)
			self.weapon_list.add(weapon)
		elif evt.key == pygame.K_a:
			weapon = Weapon('left',rect.centerx-10,rect.centery,nme,spd)
			weapon.attk(-1,0)
			self.weapon_list.add(weapon)
		elif evt.key == pygame.K_s:
			weapon = Weapon('down',rect.centerx,rect.centery,nme,spd)
			weapon.attk(0,-1)
			self.weapon_list.add(weapon)
		elif evt.key == pygame.K_d:
			weapon = Weapon('right',rect.centerx,rect.centery,nme,spd)
			weapon.attk(1,0)
			self.weapon_list.add(weapon)