added player drawing onto the screen

This commit is contained in:
specCon18 2025-01-14 03:05:15 -05:00
parent bfd9971cfb
commit ef4695aae2
4 changed files with 57 additions and 2 deletions

12
main.py
View file

@ -1,5 +1,6 @@
import pygame
from constants import *
from player import Player
def main():
print("Starting asteroids!")
@ -7,11 +8,18 @@ def main():
print(f"Screen height: {SCREEN_HEIGHT}")
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
clock = pygame.time.Clock()
dt = 0
p1 = Player(SCREEN_WIDTH/2,SCREEN_HEIGHT/2)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
screen.fill((0, 0, 0)) # simplified fill call
pygame.display.flip() # fixed typo in flip
screen.fill((0, 0, 0))
p1.draw(screen)
pygame.display.flip()
tick = clock.tick(60)
dt = tick/1000
if __name__ == "__main__":
main()