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


Python Game.outsideScreen方法代码示例

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


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

示例1: draw

# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import outsideScreen [as 别名]
    def draw(self, screen, frame_ticks, ticks, fps):
        # Move
        self.angle += self.angle_speed
        if self.angle > 359:
            self.angle = 0

        self.pos[0] -= self.speed_X
        self.pos[1] += self.angle_size * math.sin(math.radians(self.angle))

        # Animation
        self.updateAnim(ticks)

        if Game.outsideScreen(self.pos, self.rect):
            self.visible = False
        else:
            self.visible = True

        if self.pos[0] < -self.rect.width:
            self.kill()

        if self.visible:
            # Draw
            screen.blit(self.image, self.rect)

        return ["check-collisions", "player-paint"]
开发者ID:laurenceroberts,项目名称:Ludum-Dare-23,代码行数:27,代码来源:Enemy.py

示例2: draw

# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import outsideScreen [as 别名]
	def draw( self, screen, frame_ticks, ticks, fps ):
		
		if self.target:
			# Apply gravity
			#self.target[1] += 5
			
			dx = float( self.target[0] - self.pos[0] )
			dy = float( self.target[1] - self.pos[1] )
			if dy == 0: dy = 0.01
			a = math.atan(dx / dy)
			
			self.move_X = (self.speed * math.sin(a))
			self.move_Y = (self.speed * math.cos(a))
			
			if dy < 0:
				self.move_X = -self.move_X
				self.move_Y = -self.move_Y
			
			# Move
			self.pos[0] += self.move_X
			self.pos[1] += self.move_Y
			
			near_x = abs(self.pos[0] - self.target[0])
			near_y = abs(self.pos[1] - self.target[1])
			check = 10
			if near_x > -check and near_x < check and near_y > -check and near_y < check:
				self.target = None
				self.setAnimState( "splat-idle" )
				if self.pos[1] < 100: #instant drip if near top of screen
					self.age = 99
				else:
					self.age = 1
			
			self.updateAnim( ticks )
		
		if self.age > 0:
			self.age += 1
			
			if self.state == "splat-drip" and self._frame == 10:
				self.kill( )
			else:
				self.updateAnim( ticks )
			
			if self.age == 100:
				self.setAnimState( "splat-drip" )
		
		
		if Game.outsideScreen( self.pos, self.rect ):
			if self.state == "move":
				#self.visible = False
				pass
			else:
				self.kill( )	
		
		if self.visible:	
			# Draw
			screen.blit( self.image, self.rect )
		
		return None
开发者ID:laurenceroberts,项目名称:Ludum-Dare-23,代码行数:61,代码来源:Player.py


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