generated from dvorakmortonxd/pygame-template
Initial commit
This commit is contained in:
commit
88ebab1503
9 changed files with 679 additions and 0 deletions
7
render.py
Normal file
7
render.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue