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


Python Object.tick方法代碼示例

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


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

示例1: tick

# 需要導入模塊: from objects import Object [as 別名]
# 或者: from objects.Object import tick [as 別名]
 def tick(self, time_elapsed):
     Object.tick(self, time_elapsed)
     
     self.elapsed += time_elapsed
     
     if (self.elapsed >= self.duration):
         self.lvl.remove_object(self)
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:9,代碼來源:gun.py

示例2: tick

# 需要導入模塊: from objects import Object [as 別名]
# 或者: from objects.Object import tick [as 別名]
 def tick(self, time_elapsed):
     if (hasattr(self.target, 'destroyed') and self.target.destroyed):
         self.lvl.remove_object(self)
         return
     
     self.dir = (self.target.shape.position - self.shape.position).normalizing()
     
     v = self.dir.scalar(self.velocity)
     
     self.shape.velocity = v
     
     Object.tick(self, time_elapsed)
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:14,代碼來源:missile.py

示例3: tick

# 需要導入模塊: from objects import Object [as 別名]
# 或者: from objects.Object import tick [as 別名]
 def tick(self, time_elapsed):       
     Object.tick(self, time_elapsed)
             
     self.update_mouse_track(time_elapsed)
     self.update_spinning(time_elapsed)
     self.update_strafe(time_elapsed)
     
     self.simple_gun.tick(time_elapsed)
     self.simple_missile.tick(time_elapsed)
     
     self.collision_set = self.keep_colliding
     self.keep_colliding = set()
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:14,代碼來源:spaceship.py

示例4: tick

# 需要導入模塊: from objects import Object [as 別名]
# 或者: from objects.Object import tick [as 別名]
    def tick(self, time_elapsed):
        Object.tick(self, time_elapsed)
        
        self.elapsed += time_elapsed
        
        if (self.elapsed >= self.time_interval_shot):
	    self.elapsed = 0.
	    _info = {
	    'destructible'    : False,
	    'destroys_player' : False,
	    'target'          : False
	    }
	    vec_dir = (self.level.ship.shape.position - self.shape.position -  self.gun_pos).normalizing().scalar(70.)
	    bullet_pos = self.shape.position + self.gun_pos
	    shape_bull = Shape(0.01, bullet_pos)
	    shape_bull.velocity = vec_dir
	    #
	    #(self, model, shape, element, lvl, duration, damage)
	    obj_sh = SimpleShootInvasor(self.level.models['InvasorSimpleGun'][0], shape_bull, _info, self.level, 20, 5)
	    self.level.add_object(obj_sh)
	    #
	       
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:23,代碼來源:enemyship.py

示例5: tick

# 需要導入模塊: from objects import Object [as 別名]
# 或者: from objects.Object import tick [as 別名]
    def tick(self, time_elapsed):
        Object.tick(self, time_elapsed)
	if (self.asteroid_type == 'artificial'):
		self.shot_tick_counter = (self.shot_tick_counter + 1) % self.shot_tick_interval
		if (self.shot_tick_counter == 0):
			self.shot = True
開發者ID:giulianoxt,項目名稱:pyasteroids,代碼行數:8,代碼來源:asteroid.py


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