예제 #1
0
 def __update_fps_string(self):
     if '_print_fps_start_ns' not in self.__dict__:
         setattr(self, '_print_fps_start_ns', 0)
     if self.elapsed_ticks % Game.display_configuration().fps == 0:
         fps = int(
             Game.display_configuration().fps /
             ((self.time.perf_counter_ns() - self._print_fps_start_ns) /
              1000000000))
         fps_string = f'{fps} FPS'
         self._print_fps_start_ns = self.time.perf_counter_ns()
         self.__text_component.text.set_string(fps_string)
 def __update_partial_particles(self):
     from game_engine.game import Game
     self.__partial_particle_construction += (
         1 / Game.display_configuration().fps) * self.__emission_rate
     while self.__partial_particle_construction >= 1:
         Game.current_scene().add_actor(self.__construct_particle())
         self.__partial_particle_construction -= 1
예제 #3
0
 def __apply_next_pattern_node(self):
     if self.__shoot_pattern_node_list:
         self.__current_shoot_pattern_node = self.__shoot_pattern_node_list.pop(
             0)
         self.__configure_pattern_node(self.__current_shoot_pattern_node)
         self.__next_node_at_tick = self.__current_tick + (
             self.__current_shoot_pattern_node.duration_seconds *
             Game.display_configuration().fps)
     else:
         self.__current_shoot_pattern_node = None
예제 #4
0
 def __apply_next_move_node(self):
     node = self.__move_node_list.pop(0)
     self.actor.move_vector = node.movement_vector
     self.__next_node_at_tick = self.__current_tick + (
         node.time_seconds * Game.display_configuration().fps)
예제 #5
0
 def _update_lifespan(self):
     self.__remaining_lifespan -= 1 / Game.display_configuration().fps
     if self.__remaining_lifespan <= 0:
         EventDispatcher.append_event(RemoveActorFromSceneEvent(self))
예제 #6
0
파일: main.py 프로젝트: jorchube/GameEngine
 def __decrease_collision_timeout(self):
     self.__collision_timeout -= (1 / Game.display_configuration().fps)
     if self.__collision_timeout <= 0:
         self.rgb.blue = 1
         self.rgb.green = 1