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


Python Effect.sharedExplosion方法代碼示例

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


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

示例1: _ui

# 需要導入模塊: from effect import Effect [as 別名]
# 或者: from effect.Effect import sharedExplosion [as 別名]
    def _ui(self):
        self.isBackSkyReload = False
        self.isBackTileReload = False
        self.tempScore = 0
        self.time = 0
        self.init_cb()

        self.state = statePlaying
        Enemy.sharedEnemy()
        Effect.sharedExplosion()
        config.resetConfig()
        self.levelManager = self.ctl.levelManager
        self.levelManager.init(self)

        #初始化背景
        self.initBackground()

        winSize = self.winSize
        self.screenRec = CCRectMake(0, 0,  winSize.width, winSize.height + 10)
        
        # score
        self.lbScore = CCLabelBMFont.create("Score:0", s_arial14_fnt)
        self.lbScore.setAnchorPoint(1, 0)
        self.lbScore.setAlignment(kCCTextAlignmentRight)
        self.addChild(self.lbScore, 1000)
        self.lbScore.setPosition(winSize.width - 5, winSize.height - 30)
        
        # ship life
        shipTexture = CCTextureCache.sharedTextureCache().addImage(s_ship01)
        life = CCSprite.createWithTexture(shipTexture, CCRectMake(0, 0, 60, 38))
        life.setScale(0.6)
        life.setPosition(30, winSize.height-23)
        self.addChild(life, 1, 5)
        
        # ship life count
        self.lifeCount = CCLabelTTF.create(str(config.life), "Arial", 20)
        self.lifeCount.setPosition(60, winSize.height-20)
        self.lifeCount.setColor(ccc3(255,0, 0))
        self.addChild(self.lifeCount, 1000)
        
        # ship
        self.ship = None
        self.init_ship()
        
        pause = CCMenuItemImage.create("pause.png", "pause.png", 
                cb=self.cb_doPause)
        pause.setAnchorPoint(1, 0)
        pause.setPosition(winSize.width, 0)
        menu = CCMenu.create(pause)
        menu.setAnchorPoint(0, 0)
        self.addChild(menu, 1, 10)
        menu.setPosition1(CCPointZero)
        
        # 調 update函數
        # self.layer.scheduleUpdate()
        self.ctl.schedule(self.cb_update, 1/80.0)
        
        # 每秒調一次 scoreCounter函數
        self.ctl.schedule(self.cb_scoreCounter, 1)
        
        if config.isAudioOn:
            self.ctl.audio.playBackgroundMusic(s_bgMusic, True)
開發者ID:chenbk85,項目名稱:pycocos2d,代碼行數:64,代碼來源:v_game.py


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