Aug-12-2024, 10:23 PM
As the title says. Was just wondering if I could get some feedback on where the cyan square is placed on various screens.
On mine it's where I would expect. If the window is too big for the window close, pressing any key will close the window
I'll post the code and image of my screen
On mine it's where I would expect. If the window is too big for the window close, pressing any key will close the window
I'll post the code and image of my screen
import pygame
pygame.init()
# Screen resolution and color
monitor = pygame.display.Info()
resolution = (monitor.current_w, monitor.current_h/1.1)
screen = pygame.display.set_mode(resolution)
screen_color = '#222222'
# Setup framerate
clock = pygame.time.Clock()
fps = 60
# Set some flags
running = True
player_sprite = pygame.sprite.Group()
allsprites = pygame.sprite.Group()
class Player(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((50,50))
self.image.fill('cyan')
self.rect = self.image.get_rect()
self.rect.x = resolution[0]/2
self.rect.y = resolution[1] - self.rect.height*1.5
player_sprite.add(self)
allsprites.add(self)
# Create the player
player = Player()
while running:
screen.fill(screen_color)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
running = False
allsprites.update()
allsprites.draw(screen)
pygame.display.update()
clock.tick(fps)
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts
