當前位置: 首頁>>代碼示例>>Python>>正文


Python Texture.getAlpha方法代碼示例

本文整理匯總了Python中texture.Texture.getAlpha方法的典型用法代碼示例。如果您正苦於以下問題:Python Texture.getAlpha方法的具體用法?Python Texture.getAlpha怎麽用?Python Texture.getAlpha使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在texture.Texture的用法示例。


在下文中一共展示了Texture.getAlpha方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import getAlpha [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 getAlpha [as 別名]

#.........這裏部分代碼省略.........
				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
			if self.menu_play_button.getState() == 1:
				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_music.isPaused() == False:
					self.menu_music.fadeOut()

				if self.menu_play_button.getAlpha() == 0:
					self.menu_play_button.setNext( 0 )
					self.core.setState( 1 )

#-------------------------------------------------------------------------------------------------------STATE 1
		
		if self.core.getState() == 1:
			
			#FADE IN IF PAUSE BUTTON == OFF AND MENU_LOG == OFF
			if self.menu_log.getState() == 0:
				self.wall.fadein( 5 )
				self.hero.fadein( 5 )
開發者ID:Adriqun,項目名稱:C-CPP-SDL2,代碼行數:70,代碼來源:engine.py


注:本文中的texture.Texture.getAlpha方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。