当前位置: 首页>>代码示例>>Python>>正文


Python Ship.hp方法代码示例

本文整理汇总了Python中Ship.hp方法的典型用法代码示例。如果您正苦于以下问题:Python Ship.hp方法的具体用法?Python Ship.hp怎么用?Python Ship.hp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ship的用法示例。


在下文中一共展示了Ship.hp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import Ship [as 别名]
# 或者: from Ship import hp [as 别名]

#.........这里部分代码省略.........
				new_upgrade = UPGRADE_TYPES[randint(0,len(UPGRADE_TYPES)-1)](randint(0,screen_size[0]),randint(0,screen_size[1]),randint(-2,2),randint(-2,2))
				allsprites.append(new_upgrade)
				upgrade_time_elapser = time()


			for laser in allsprites:#This loop detects collisions between lasers and things
				if laser.generictype == "MyWeapon":
					for other_object in allsprites:
						if other_object.generictype == "PowerUp":
							if pygame.Rect.colliderect(laser.hitbox, other_object.hitbox) == 1:

								for i in range(0,100):
									if randint(0,600) < 30:
										new_GoldCoin = GoldCoin(other_object.x, other_object.y, random()*randint(-2,2), random()*randint(1,2))
										allsprites.append(new_GoldCoin)

								explosion1.play()
								allsprites.remove(other_object)
								try:
									allsprites.remove(laser)
								except:
									pass
								else:
									pass

						elif other_object.generictype == "Enemy":
							if pygame.Rect.colliderect(laser.hitbox, other_object.hitbox) == 1:
								try:
									allsprites.remove(laser)
								except:
									pass
								else:
									pass
								other_object.hp -= laser.damage
								damage0.play()
								if other_object.hp < 0:
									explosion1.play()

									for i in range(int(other_object.points/(1/other_object.drops)+other_object.formation)):
										if randint(0,other_object.points) > 1000:
											new_PlatinumCoin = PlatinumCoin(other_object.x, other_object.y, random()*randint(-2,2), random()*randint(1,2))
											allsprites.append(new_PlatinumCoin)

										elif randint(0,other_object.points) > 75:
											new_GoldCoin = GoldCoin(other_object.x, other_object.y, random()*randint(-2,2), random()*randint(1,2))
											allsprites.append(new_GoldCoin)

										elif randint(0,other_object.points) > 25:
											new_SilverCoin = SilverCoin(other_object.x, other_object.y, random()*randint(-2,2), random()*randint(1,2))
											allsprites.append(new_SilverCoin)

										elif randint(0,other_object.points) > 0:
											new_CopperCoin = CopperCoin(other_object.x, other_object.y, random()*randint(-2,2), random()*randint(1,2))
											allsprites.append(new_CopperCoin)

									try:
										swallows.remove(other_object)
									except:
										pass
									else:
										pass

									try:
										crows.remove(other_object)
									except:
										pass
开发者ID:Calendis,项目名称:S3,代码行数:70,代码来源:void.py


注:本文中的Ship.hp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。