Exemple #1
0
	def __init__(self):
		self.bounds = py.Rect(WIDTH // 2, HEIGHT // 2, 0, 0)

		self.animation = Animation("walk", [load_img("image (1)", 2), load_img("image (2)", 2)], 250)

		self.bounds.width, self.bounds.height = self.animation.width, self.animation.height

		self.bounds.x -= self.bounds.width // 2
Exemple #2
0
    def __init__(self):
        """Constructor"""
        self.__background = load_img("backgrounds/level", 2)

        self.__floor = []
        self.__ladders = []

        self.__loadFloor()
        self.__loadLadders()
Exemple #3
0
    def __init__(self):
        self.img = load_img("player")
        self.bounds = self.img.get_rect()
        self.vy, self.vx = 0, 0
        self.gravity = 1
        self.horizontal_speed = 5
        self.on_ground = False
        self.max_fall_speed = 8
        self.facing_left = False
        self.jump_power = -18

        self.center_object()
Exemple #4
0
    def __init__(self):
        """Constructor"""
        self.__inimator = Animator()

        self.__bounds = Rect(250, 0, 0, 0)
        self.__bounds.size = self.__inimator.add_animation(
            "moving", 500, "peach/peach", 2, 2)
        self.__bounds.bottom = 79

        # Elementos necesarios para mostrar el mensaje de HELP cada cierto tiempo
        self.__timer = Timer(550)
        self.__help = load_img("misc/help", 2)
        self.__showHelp = True
Exemple #5
0
    def __load_frames(self, _image_name, _number_frames, _scale=1):
        """[Private Method]
			Load a list of frames
			Parameters:
				_image_name -- The name that the frames have inside the
					folder. All the frames in it have to be called from the
					same way, but it has to be numbered so that they are loaded
					correctly.
				_number_frames -- Number of frames the animation has.
				_scale -- Scale at which you want to resize the frames
					of animation. By default, no frames in the animation
					it will escalate."""
        frames = []
        for i in range(1, _number_frames + 1):
            frames.append(load_img(_image_name + " (" + str(i) + ")", _scale))
        return frames
Exemple #6
0
 def __init__(self, _states_manager):
     self.background = load_img("main_menu")
     self.states_manager = _states_manager
Exemple #7
0
    def __init__(self, _sm):
        """Inicializa todos los componentes del estado.
			Parámetros:
				_sm -- Gestor de estados por si se quiere moverse entre estados."""
        self.__gfx = load_img("backgrounds/main_menu", 2)
        self.__statesManager = _sm