def start(self): self.physics = Physics(self) self.star_score_controller = GameObject.find_by_type( "StarScoreController")[0] self.main_scene_controller = GameObject.find_by_type( "MainSceneController")[0] self.invencible_power_up_controller = GameObject.find_by_type( "InvenciblePowerUpController")[0] self.animation = CirclePlayerInitialAnimation(self) self.animator = Animator(self, [self.animation]) self.death_sound = mixer.Sound( 'game/assets/soundtrack/ball_death_01.ogg') self.particle_system = ParticleSystem(self, Particle, quant=5, period=0.07, vel_min=30, vel_max=200, duration=0.5, inherit_vel=True, inherit_vel_mult=-0.7) self.particle_system.set_circ_gen(self.transform.position, self.circle_mesh.get_radius(), mode="directional", direct_met=self.direct_met, ini_angle_met=self.ini_angle_met, fin_angle_met=self.fin_angle_met) self.particle_system.play()
def update(self): if Time.time_scale == 0.0: #Paused game. Adjust timers self.time_of_last_invencibily += Time.delta_time(True) difference_time = Time.now() - self.time_of_last_invencibily if difference_time > self.invecible_time: for i in range(2): self.player_controller.game_object_list[ i].is_invencible = False self.get_back_to_original_colors() self.current_animation_tick_index = 0 else: value = min(difference_time / self.invecible_time, 1) # Just to convert between 0 and 1 diff = abs( value - self.animation_ticks_times[self.current_animation_tick_index]) if (diff < 0.01): self.current_animation_tick_index += 1 self.tick_colors() for obstacle in self.game_object_list: if obstacle.transform.position.y > Constants.screen_height: self.game_object_list.remove(obstacle) obstacle.destroy(obstacle) GameObject.destroy(obstacle) else: self.fall(obstacle) self.delete_power_up_text()
def update(self): """ NomalBehaivor update method will be call every frame """ if self.is_out_of_screen(): GameObject.destroy(self) self.fall()
def update(self): for obstacle in self.game_object_list: if obstacle.transform.position.y > Constants.screen_height: self.game_object_list.remove(obstacle) obstacle.destroy(obstacle) GameObject.destroy(obstacle) else: self.fall(obstacle)
def update(self): if len(self.game_object_list) > 0: for obstacle_pair in self.game_object_list: if obstacle_pair[0].transform.position.y > Constants.screen_height: self.game_object_list.remove(obstacle_pair) for obstacle in obstacle_pair: obstacle.destroy(obstacle) GameObject.destroy(obstacle) else: self.fall(obstacle_pair)
def update(self): for obstacle in self.game_object_list: if obstacle.transform.position.y > Constants.screen_height: self.game_object_list.remove(obstacle) obstacle.destroy(obstacle) GameObject.destroy(obstacle) else: self.fall(obstacle) if obstacle.visible and obstacle.transform.position.y > 0.15 * Constants.screen_height: self.turn_invisible(obstacle) obstacle.visible = False
def awake(self): self.score_controller = GameObject.find_by_type("ScoreController")[0]
def awake(self): self.player_controller = GameObject.find_by_type("PlayerController")[0]
def update(self): """ Will destroy the animation after finished it """ if Time.now() - self.creation_time > self.fade_duration * 2: GameObject.destroy(self)