created new submodule to contain game elements
This commit is contained in:
parent
65365adc3d
commit
b97d54f49d
1
pocket_friends/game_files/elements/__init__.py
Normal file
1
pocket_friends/game_files/elements/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""Sub-module for use in the game. Helps with the drawing of various objects such as sprites and text boxes."""
|
@ -4,10 +4,20 @@ import json
|
||||
|
||||
class SpriteSheet:
|
||||
"""
|
||||
Imports a sprite sheet as separate pygame images given an image file and a json file.
|
||||
Class to be used by sprites in order to give them a texture and an animation.
|
||||
|
||||
Attributes:
|
||||
images (list) List of all the sprites in the animation separated from the sprite sheet.
|
||||
"""
|
||||
|
||||
def __init__(self, sprite_sheet, texture_json):
|
||||
"""
|
||||
Creates a sprite sheet given a sprite image and its corresponding JSON file.
|
||||
Args:
|
||||
sprite_sheet (str): The path of the sprite sheet image component.
|
||||
texture_json (str): The path of the sprite sheet JSON component, contains the number of frames in the
|
||||
sprite sheet, and the width and height of an individual sprite from the sprite sheet.
|
||||
"""
|
||||
# Load in whole sprite sheet as one image.
|
||||
self.sprite_sheet = pygame.image.load(sprite_sheet).convert_alpha()
|
||||
self.images = []
|
@ -1,5 +1,5 @@
|
||||
import pygame
|
||||
from . import sprites
|
||||
from ..elements import sprites
|
||||
import pocket_friends.game_files.io.gpio_handler as gpio_handler
|
||||
from ..io.input_handler import InputHandler
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import pygame
|
||||
from . import sprites
|
||||
from ..elements import sprites
|
||||
import pocket_friends.game_files.io.gpio_handler as gpio_handler
|
||||
from .sprites import SelectionEgg
|
||||
from ..io.input_handler import InputHandler
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user