7 lines
540 B
Python
7 lines
540 B
Python
import pygame # imports pygame obviously
|
|
|
|
def load_sprite(sheet, x, y, width, height, screen_width, screen_height): # the function for our sprite rendering function
|
|
rect = pygame.Rect(x, y, width, height) # this defines our cutout from the sprite sheet its like position; size
|
|
sprite = sheet.subsurface(rect) # this goes on to cut it from the sheet actually
|
|
scaled = pygame.transform.scale(sprite, (screen_width, screen_height)) # this scales the cutout to what we want/what we chose
|
|
return scaled # this returns our cutout
|