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


Python Texture.fadeout方法代码示例

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


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

示例1: __init__

# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import fadeout [as 别名]
class Wall:

#-------------------------------------------------------------------------------------------------------
	
	def __init__( self ):
		self.bg_one = Texture( "wall/14.png" )
		self.bg_two = Texture( "wall/14.png" )

#-------------------------------------------------------------------------------------------------------

	def load( self ):
		self.bg_two.setX( self.bg_two.getWidth() )
		

#-------------------------------------------------------------------------------------------------------
	
	def draw( self, window, move = True, vel = 2 ):

		if self.bg_one.getAlpha() == 255 and move:
			self.bg_one.setX( self.bg_one.getLeft() - vel )
			self.bg_two.setX( self.bg_two.getLeft() - vel )
		
			if self.bg_one.getLeft() <= -self.bg_one.getWidth():
				self.bg_one.setX( self.bg_one.getWidth() )
			elif self.bg_two.getLeft() <= -self.bg_two.getWidth():
				self.bg_two.setX( self.bg_two.getWidth() )
			
		
		self.bg_one.draw( window )
		self.bg_two.draw( window )

#-------------------------------------------------------------------------------------------------------

	def getAlpha( self ):
		return self.bg_two.getAlpha()

#-------------------------------------------------------------------------------------------------------

	def fadein( self, i = 1, m = 255 ):
		self.bg_one.fadein( i, m )
		self.bg_two.fadein( i, m )

#-------------------------------------------------------------------------------------------------------

	def fadeout( self, i = 1, m = 0 ):
		self.bg_one.fadeout( i, m )
		self.bg_two.fadeout( i, m )
开发者ID:Adriqun,项目名称:C-CPP-SDL2,代码行数:49,代码来源:wall.py

示例2: __init__

# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import fadeout [as 别名]
class Menu_title:

#-------------------------------------------------------------------------------------------------------

	def __init__( self ):
		self.texture =  Texture( "menu/belt.png" )
		self.text = Text( "menu/KGHAPPY.ttf", 80 )

#-------------------------------------------------------------------------------------------------------		
		
	def load( self, width ):
		
		self.texture.setX( ( width / 2 ) - ( self.texture.getWidth() / 2 ) )
		self.texture.setY( 10 )

		self.text.createText( "Ninja", [ 0x7F, 0x99, 0x95 ] )
		self.text.setX( ( width / 2 ) - ( self.text.getWidth() / 2 ) )
		self.text.setY( 0 )

#-------------------------------------------------------------------------------------------------------

	def draw( self, window ):
		self.texture.draw( window )
		self.text.draw( window )

#-------------------------------------------------------------------------------------------------------
		
	def getBot( self ):
		return self.texture.getBot()

#-------------------------------------------------------------------------------------------------------
	
	def fadein( self, i = 1, m = 255 ):
		self.texture.fadein( i, m )
		self.text.fadein( i, m )

#-------------------------------------------------------------------------------------------------------

	def fadeout( self, i = 1, m = 0 ):
		self.texture.fadeout( i, m )
		self.text.fadeout( i, m )
开发者ID:Adriqun,项目名称:C-CPP-SDL2,代码行数:43,代码来源:menu_title.py

示例3: __init__

# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import fadeout [as 别名]

#.........这里部分代码省略.........
			self.menu_exit_log.draw( self.core.getWindow() )
			#DRAW IF AUTHOR BUTTON == OFF AND SCORE BUTTON == OFF
			if self.menu_author_log.getState() == 0 and self.menu_score_log.getState() == 0:
				self.menu_git_button.draw( self.core.getWindow() )			
				self.menu_google_button.draw( self.core.getWindow() )
				self.menu_facebook_button.draw( self.core.getWindow() )
				self.menu_twitter_button.draw( self.core.getWindow() )
				self.menu_play_button.draw( self.core.getWindow() )
				self.menu_music_button.draw( self.core.getWindow() )
				self.menu_chunk_button.draw( self.core.getWindow() )
				self.menu_game_log.draw( self.core.getWindow() )
				self.menu_settings_log.draw( self.core.getWindow() )

			if self.menu_score_log.getState() == 0:
				self.menu_author_log.draw( self.core.getWindow() )
			if self.menu_author_log.getState() == 0:
				self.menu_score_log.draw( self.core.getWindow() )

			#IF USER TURN ON/OFF CHUNKS
			if self.menu_chunk_button.getState():
				self.menu_play_button.setState()
				self.menu_git_button.setState()
				self.menu_google_button.setState()
				self.menu_music_button.setState()
				self.menu_chunk_button.setState()
				self.menu_author_log.setState()
				self.menu_score_log.setState()
			#IF USER TURN ON/OFF MUSIC
			if self.menu_music_button.getState():
				self.menu_music.pause()

			#IF USER PRESS Q - EXIT
			if self.menu_exit_log.getState() == 1:
				self.menu_background.fadeout( 6, 120 )
				self.menu_title.fadeout( 6, 120 )
				self.menu_play_button.fadeout( 6, 120 )
				self.menu_git_button.fadeout( 6, 120 )
				self.menu_google_button.fadeout( 6, 120 )
				self.menu_facebook_button.fadeout( 6, 120 )
				self.menu_twitter_button.fadeout( 6, 120 )
				self.menu_music_button.fadeout( 6, 120 )
				self.menu_chunk_button.fadeout( 6, 120 )
				self.menu_author_log.fadeout( 6, 120 )
				self.menu_game_log.fadeout( 6, 120 )
				self.menu_settings_log.fadeout( 6, 120 )
				self.menu_score_log.fadeout( 6, 120 )
				self.menu_music.setVolume( 0.3 )

			elif self.menu_exit_log.getState() == 2:
				self.menu_background.fadeout( 6 )
				self.menu_title.fadeout( 6 )
				self.menu_play_button.fadeout( 6 )
				self.menu_git_button.fadeout( 6 )
				self.menu_google_button.fadeout( 6 )
				self.menu_facebook_button.fadeout( 6 )
				self.menu_twitter_button.fadeout( 6 )
				self.menu_music_button.fadeout( 6 )
				self.menu_chunk_button.fadeout( 6 )
				self.menu_author_log.fadeout( 6 )
				self.menu_game_log.fadeout( 6 )
				self.menu_settings_log.fadeout( 6 )
				self.menu_score_log.fadeout( 6 )
			if self.menu_exit_log.getState() == 2 and self.menu_background.getAlpha() == 0:
				self.core.setQuit()

			#IF USER CLICK PLAY BUTTON
开发者ID:Adriqun,项目名称:C-CPP-SDL2,代码行数:70,代码来源:engine.py

示例4: __init__

# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import fadeout [as 别名]
class Menu_music_button:

#-------------------------------------------------------------------------------------------------------

	def __init__( self, path, on = 0 ):

		self.sprite = Sprite( path, 4 )

		self.scratch = Texture( "menu/scratch.png" )
		self.click = pygame.mixer.Sound( "menu/click.wav" )

		self.type = 0
		self.state = 0
		self.on = on
		self.mouseup = 0

#-------------------------------------------------------------------------------------------------------
	
	def load( self, y ):
		self.sprite.setX( 10 )
		self.sprite.setY( y )
		
		self.scratch.setX( 10 )
		self.scratch.setY( y )

#-------------------------------------------------------------------------------------------------------

	def getBot( self ):
		return self.sprite.getBot()

#-------------------------------------------------------------------------------------------------------
	
	def draw( self, window ):
		self.sprite.draw( window )
		if self.type == 1:
			self.scratch.draw( window )

#-------------------------------------------------------------------------------------------------------

	def fadein( self, i = 1, m = 255 ):
		self.sprite.fadein( i, m )
		self.scratch.fadein( i, m )

#-------------------------------------------------------------------------------------------------------

	def fadeout( self, i = 1, m = 0 ):
		self.sprite.fadeout( i, m )
		self.scratch.fadeout( i, m )

#-------------------------------------------------------------------------------------------------------

	def getState( self ):
		if self.state != self.type:
			self.state = self.type
			#print "true!"
			return True
		return False

#-------------------------------------------------------------------------------------------------------

	def setState( self ):
		if self.on == 0:
			self.on = 1
		else:
			self.on = 0
		# print self.on

#-------------------------------------------------------------------------------------------------------

	def handle( self, event ):
			
		self.focus = False
		self.sprite.setOffset( 0 )

		if event.type == pygame.MOUSEBUTTONDOWN:
			self.focus = True
			self.mouseup = 1
		elif event.type == pygame.MOUSEBUTTONUP:
			self.mouseup = 0
		
		
		self.x, self.y = pygame.mouse.get_pos()
		if self.x > self.sprite.getLeft() and self.x < self.sprite.getRight() and self.sprite.getAlpha() == 255:
			if self.y > self.sprite.getTop() and self.y < self.sprite.getBot():
				if self.focus == True:
					if self.on == 0:
						self.click.play()
					if self.type == 0:
						self.type = 1
					else:
						self.type = 0
				if self.focus == True or self.mouseup == 1:
					self.sprite.setOffset( 2 )
				else:
					self.sprite.setOffset( 1 )
开发者ID:Adriqun,项目名称:C-CPP-SDL2,代码行数:97,代码来源:menu_music_button.py

示例5: __init__

# 需要导入模块: from texture import Texture [as 别名]
# 或者: from texture.Texture import fadeout [as 别名]
class Menu_score_log:

#-------------------------------------------------------------------------------------------------------

	def __init__( self ):

		self.sprite = Sprite( "menu/position.png", 4 )
		self.window = Texture( "menu/window.png" )
		self.click = pygame.mixer.Sound( "menu/click.wav" )

		self.on = 0
		self.type = 0
		self.text = Text( "menu/KGHAPPY.ttf", 30 )

#-------------------------------------------------------------------------------------------------------
	
	def load( self, x, width, titlebot, bot ):

		self.sprite.setX( x )
		self.sprite.setY( bot +10 )
		
		self.window.setX( width/2 - self.window.getWidth()/2 )
		self.window.setY( titlebot -20 )
		

		self.text.createText( "SCORES", [ 0xd5, 0xad, 0x51 ] )
		self.text.setX( self.window.getLeft() + self.window.getWidth()/2 - self.text.getWidth()/2 )
		self.text.setY( self.window.getTop() +50 )

#-------------------------------------------------------------------------------------------------------

	def draw( self, screen ):
		if self.type == 1:
			self.window.draw( screen )
			self.text.draw( screen )
		else:
			self.sprite.draw( screen )

#-------------------------------------------------------------------------------------------------------

	def fadein( self, i = 1, m = 255 ):
		self.sprite.fadein( i, m )
		self.window.fadein( i, m )
		self.text.fadein( i, m )
#-------------------------------------------------------------------------------------------------------

	def fadeout( self, i = 1, m = 0 ):
		self.sprite.fadeout( i, m )
		self.window.fadeout( i, m )
		self.text.fadeout( i, m )

#-------------------------------------------------------------------------------------------------------

	def getState( self ):
		return self.type

#-------------------------------------------------------------------------------------------------------

	def getRight( self ):
		return self.sprite.getRight()

#-------------------------------------------------------------------------------------------------------

	def setState( self ):
		if self.on == 0:
			self.on = 1
		else:
			self.on = 0

#-------------------------------------------------------------------------------------------------------

	def handle( self, event ):
			
		self.focus = False
		if event.type == pygame.MOUSEBUTTONDOWN:
			self.focus = True
		
		if self.type == 0:
			self.sprite.setOffset( 0 )
			self.x, self.y = pygame.mouse.get_pos()
			if self.x > self.sprite.getLeft() and self.x < self.sprite.getRight() and self.sprite.getAlpha() == 255:
				if self.y > self.sprite.getTop() and self.y < self.sprite.getBot():
					if self.focus == True:
						if self.on == 0:
							self.click.play()
						self.sprite.setOffset( 2 )
						if self.type == 0:
							self.type = 1
					else:
						self.sprite.setOffset( 1 )
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_ESCAPE or event.key == pygame.K_SPACE:
				if self.type == 1:
					if self.on == 0:
						self.click.play()
					self.type = 0
开发者ID:Adriqun,项目名称:C-CPP-SDL2,代码行数:98,代码来源:menu_score_log.py


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