put everything on a surface, so we can stack other suraces and hopefully not cry

This commit is contained in:
2025-06-13 22:06:47 +01:00
parent f5356b3201
commit 09be12d6ea

View File

@ -1,8 +1,8 @@
import pygame
from random import randint
screenx = 1280
screeny = 720
screenw = 1280
screenh = 720
yOffset = 0
pygame.init()
@ -13,7 +13,8 @@ GunShot = pygame.mixer.Sound("sfx/gun-shot.mp3")
GunSpin = pygame.mixer.Sound("sfx/gun-spin.mp3")
screen = pygame.display.set_mode((screenx,screeny))
screen = pygame.display.set_mode((screenw,screenh))
MainSurface = pygame.Surface((screenw,screenh-yOffset))
clock = pygame.time.Clock()
running = True #you better start running...
@ -24,8 +25,8 @@ while running:
screen.fill("black")
fireButton = pygame.Rect(0,0,300,100)
pygame.draw.rect(screen, (30,30,30), fireButton)
pygame.draw.rect(MainSurface, (30,30,30), (0,0,300,100))
screen.blit(MainSurface,(0,yOffset))
pygame.display.flip()