Delete 'program.py'
This commit is contained in:
parent
c279762753
commit
f17e5a650e
53
program.py
53
program.py
@ -1,53 +0,0 @@
|
|||||||
import pygame
|
|
||||||
from os import sys
|
|
||||||
from generate import Generate
|
|
||||||
from floor import Floor
|
|
||||||
from wall import Wall
|
|
||||||
from shelf import Shelf
|
|
||||||
from wheel import Wheel
|
|
||||||
from boxOnTheFloor import BoxOnTheFloor
|
|
||||||
from box import Box
|
|
||||||
from unboxOnTheFloor import UnboxOnTheFloor
|
|
||||||
|
|
||||||
class MainWindow:
|
|
||||||
def __init__(self, szerokosc, wysokosc, kruche, latwopalne, radioaktywne, niebezpieczne):
|
|
||||||
#config
|
|
||||||
self.cell = 50
|
|
||||||
#init
|
|
||||||
pygame.init()
|
|
||||||
pygame.display.set_caption('Inteligentny wózek widłowy')
|
|
||||||
self.map = Generate.generate(szerokosc+2, wysokosc+2, kruche, latwopalne, radioaktywne, niebezpieczne)
|
|
||||||
self.screen = pygame.display.set_mode((((szerokosc+2)*self.cell), ((wysokosc+2)*self.cell)))
|
|
||||||
#create
|
|
||||||
self.wheel = Wheel(self.screen, self.cell);
|
|
||||||
for i in range(len(self.map)):
|
|
||||||
for j in range(len(self.map[i])):
|
|
||||||
if (self.map[i][j]==1):
|
|
||||||
self.map[i][j] = Wall(self.screen, self.cell, i, j)
|
|
||||||
elif (self.map[i][j]==2):
|
|
||||||
self.map[i][j] = Floor(self.screen, self.cell, i, j)
|
|
||||||
elif (self.map[i][j]==23):
|
|
||||||
self.map[i][j] = UnboxOnTheFloor(self.screen, self.cell, i, j)
|
|
||||||
else:
|
|
||||||
self.map[i][j] = Shelf(self.screen, self.cell, i, j, (self.map[i][j]-3)%4, (self.map[i][j]-3)//4)
|
|
||||||
#loop
|
|
||||||
while True:
|
|
||||||
self.events()
|
|
||||||
self.draw()
|
|
||||||
|
|
||||||
def events(self):
|
|
||||||
for event in pygame.event.get():
|
|
||||||
if(event.type==pygame.QUIT):
|
|
||||||
sys.exit()
|
|
||||||
elif(event.type==pygame.KEYDOWN):
|
|
||||||
self.wheel.move(event, self.map)
|
|
||||||
elif(event.type==pygame.MOUSEBUTTONDOWN):
|
|
||||||
if (type(self.map[0][2]) == Floor):
|
|
||||||
self.map[0][2] = BoxOnTheFloor(self.screen, self.cell, 0, 2, Box())
|
|
||||||
def draw(self):
|
|
||||||
self.screen.fill((33,69,108))
|
|
||||||
for i in range(len(self.map)):
|
|
||||||
for j in range(len(self.map[i])):
|
|
||||||
self.map[i][j].draw()
|
|
||||||
self.wheel.draw()
|
|
||||||
pygame.display.flip()
|
|
Loading…
Reference in New Issue
Block a user