refactoring_1.0 #2
1
agent.py
1
agent.py
@ -5,7 +5,6 @@ class trashmaster(pygame.sprite.Sprite):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
|
||||||
self.images = []
|
self.images = []
|
||||||
self.image = pygame.image.load("resources/textures/trashmaster_blu.png")
|
self.image = pygame.image.load("resources/textures/trashmaster_blu.png")
|
||||||
self.image = pygame.transform.scale(self.image, (16, 16))
|
self.image = pygame.transform.scale(self.image, (16, 16))
|
||||||
|
52
main.py
52
main.py
@ -2,41 +2,53 @@ import pygame
|
|||||||
from map import preparedMap
|
from map import preparedMap
|
||||||
from agent import trashmaster
|
from agent import trashmaster
|
||||||
|
|
||||||
pygame.init()
|
|
||||||
|
|
||||||
#config
|
class WalleGame():
|
||||||
SCREEN_SIZE = [512, 512]
|
|
||||||
BACKGROUND_COLOR = '#ffffff'
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def __init__(self):
|
||||||
|
self.SCREEN_SIZE = [512, 512]
|
||||||
|
self.BACKGROUND_COLOR = '#ffffff'
|
||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
|
||||||
# tytul okna
|
|
||||||
pygame.display.set_caption('Wall-e')
|
pygame.display.set_caption('Wall-e')
|
||||||
|
|
||||||
screen = pygame.display.set_mode(SCREEN_SIZE)
|
|
||||||
screen.fill(pygame.Color(BACKGROUND_COLOR))
|
self.screen = pygame.display.set_mode(self.SCREEN_SIZE)
|
||||||
|
self.screen.fill(pygame.Color(self.BACKGROUND_COLOR))
|
||||||
|
|
||||||
# krata
|
# krata
|
||||||
map = preparedMap(SCREEN_SIZE)
|
self.map = preparedMap(self.SCREEN_SIZE)
|
||||||
screen.blit(map, (0,0))
|
self.screen.blit(self.map, (0,0))
|
||||||
|
|
||||||
# update okna
|
def update_window(self):
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
smieciara1 = trashmaster()
|
def draw_trashmaster(self, smieciara: trashmaster):
|
||||||
smieciara_list = pygame.sprite.Group()
|
smieciara_list = pygame.sprite.Group()
|
||||||
smieciara_list.add(smieciara1)
|
smieciara_list.add(smieciara)
|
||||||
smieciara_list.draw(screen)
|
smieciara_list.draw(self.screen)
|
||||||
|
|
||||||
pygame.display.update()
|
|
||||||
|
|
||||||
running = True
|
|
||||||
while running:
|
def main():
|
||||||
|
game = WalleGame()
|
||||||
|
game.update_window()
|
||||||
|
|
||||||
|
smieciara_object = trashmaster()
|
||||||
|
game.draw_trashmaster(smieciara_object)
|
||||||
|
|
||||||
|
game.update_window()
|
||||||
|
|
||||||
|
running = True
|
||||||
|
|
||||||
|
while running:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
running = False
|
running = False
|
||||||
|
pygame.quit()
|
||||||
|
pygame.quit()
|
||||||
|
|
||||||
|
|
||||||
pygame.quit()
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
pygame==2.1.2
|
Loading…
Reference in New Issue
Block a user