diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c26f249 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +modules/__pycache__/gameobjects.cpython-312.pyc diff --git a/main.py b/main.py index 3fb71e5..21dea0c 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ import pygame import subprocess import random +from modules.gameobjects import * @@ -26,9 +27,10 @@ ROT = (255,0,0) font1 = pygame.font.SysFont("Noto Sans 10pt", 25) - PLAYGROUND = pygame.Surface((1024,728)) +obj1 = GameObjects("Test", 0,0) + gamestate = True #Mapfiles for Mapgen @@ -52,6 +54,7 @@ pacman_animation.append(pygame.image.load("models/pacman_1_4.png")) pacman_animation.append(pygame.image.load("models/pacman_1_5.png")) + #ITEMS fruits = list() @@ -92,7 +95,6 @@ def generate_map(*mapfile): startpos_x = 0 startpos_y += map_wall_size - generate_map() movement_map_center = (map_space_size-pacman_size)/2 @@ -155,11 +157,8 @@ while(gamestate==True): pacman_posx -= pacman_movespeed - MAINSCREEN.blit(pacman_animation[count], (pacman_posx,pacman_posy)) + MAINSCREEN.blit(pacman_animation[0], (pacman_posx,pacman_posy)) - count += 1 - - if count == 5: count = 0 for row in map1: MAINSCREEN.blit(row["object"], (row["x"],row["y"])) @@ -184,11 +183,4 @@ while(gamestate==True): MAINSCREEN.blit(hash_label, (10, MAINSCREEN_SIZE[1]-40)) pygame.display.flip() - clock.tick(60) - - count2 += 1 - if(count2 == 60): - count2 = 0 - - - \ No newline at end of file + clock.tick(60) \ No newline at end of file diff --git a/modules/gameobjects.py b/modules/gameobjects.py new file mode 100644 index 0000000..2b002e3 --- /dev/null +++ b/modules/gameobjects.py @@ -0,0 +1,10 @@ +import pygame + +class GameObjects(): + def __init__(self, name, posx:int, posy:int) -> None: + self.posx = posx + self.posy = posy + self.name = name + + self.rect:pygame.rect + pass \ No newline at end of file