本文整理汇总了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 )
示例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 )