Alter 9 files

Update components.py
Update gameplay.py
Update resources.py
Add character_head_1.png
Add character_head_2.png
Add character_head_3.png
Add character_torso_1.png
Add character_torso_2.png
Add character_torso_3.png

# Conflicts:
#	game/gameplay.py
#	game/resources.py
This commit is contained in:
akp 2025-03-23 00:21:38 +00:00
parent 768ae7db4c
commit 9f863cd1f2
8 changed files with 32 additions and 2 deletions

View file

@ -1,7 +1,7 @@
from operator import truediv
import random
import pygame
import resources
import util
class SurfaceButton:
@ -67,3 +67,20 @@ def text_button(text, size, font=resources.FONT_SM) -> SurfaceButton:
)
return SurfaceButton(surface)
class Character:
torso: pygame.Surface
head: pygame.Surface
headpos: int
def __init__(self):
self.torso = random.choice(resources.CHARACTER_TORSOS)
self.head = random.choice(resources.CHARACTER_HEADS)
self.headpos = self.head.get_size()[1] * random.randint(6, 9) / 10
def blit_onto(self, output_surface: pygame.SurfaceType, pos: tuple[int, int]):
output_surface.blit(self.torso, util.add_coord(pos, (0, self.headpos)))
torso_centerpoint = util.center_within(self.torso.get_size(), self.head.get_size())
output_surface.blit(self.head, util.add_coord(pos, (torso_centerpoint[0], 0)))

View file

@ -41,5 +41,18 @@ TICKET_TOP_SPRITE_3X = pygame.transform.scale_by(TICKET_TOP_SPRITE, 3)
SUB_BOTTOM_SPRITE = pygame.image.load(RESOURCES_DIR / "sprites" / "sub_bottom.png")
SUB_BOTTOM_SPRITE_10X = pygame.transform.scale_by(SUB_BOTTOM_SPRITE, 10)
TICKET_BOTTOM_SPRITE = pygame.image.load(RESOURCES_DIR / "sprites" / "ticket_bottom.png")
TICKET_BOTTOM_SPRITE_3X = pygame.transform.scale_by(TICKET_BOTTOM_SPRITE, 3)
CHARACTER_TORSOS = [
pygame.image.load(RESOURCES_DIR / "sprites" / "character_torso_1.png"),
pygame.image.load(RESOURCES_DIR / "sprites" / "character_torso_2.png"),
pygame.image.load(RESOURCES_DIR / "sprites" / "character_torso_3.png"),
]
CHARACTER_HEADS = [
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_1.png"),
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_2.png"),
pygame.image.load(RESOURCES_DIR / "sprites" / "character_head_3.png"),
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 B