wydzielono map.py
This commit is contained in:
parent
70e4b7ba69
commit
97a42dab72
39
main.py
39
main.py
@ -1,32 +1,33 @@
|
|||||||
import pygame
|
import pygame
|
||||||
pygame.init()
|
from map import preparedMap
|
||||||
|
|
||||||
pygame.display.set_caption('Wall-e')
|
#config
|
||||||
|
SCREEN_SIZE = [512, 512]
|
||||||
|
BACKGROUND_COLOR = '#ffffff'
|
||||||
|
|
||||||
screen = pygame.display.set_mode([512, 512])
|
if __name__ == '__main__':
|
||||||
screen.fill(pygame.Color('#ffffff'))
|
|
||||||
|
|
||||||
|
pygame.init()
|
||||||
|
|
||||||
tileImage = pygame.image.load('tile1.png')
|
# tytul okna
|
||||||
|
pygame.display.set_caption('Wall-e')
|
||||||
|
|
||||||
surfaceSize = width, height = (512, 512)
|
screen = pygame.display.set_mode(SCREEN_SIZE)
|
||||||
surface = pygame.Surface(surfaceSize)
|
screen.fill(pygame.Color(BACKGROUND_COLOR))
|
||||||
|
|
||||||
for x in range(0, 512, 16):
|
# krata
|
||||||
for y in range(0, 512, 16):
|
map = preparedMap(SCREEN_SIZE)
|
||||||
surface.blit(tileImage, (x, y))
|
screen.blit(map, (0,0))
|
||||||
|
|
||||||
screen.blit(surface, (0,0))
|
# update okna
|
||||||
|
pygame.display.update()
|
||||||
|
|
||||||
pygame.display.update()
|
# event loop
|
||||||
|
running = True
|
||||||
running = True
|
while running:
|
||||||
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
|
||||||
|
|
||||||
|
# end
|
||||||
pygame.quit()
|
pygame.quit()
|
||||||
|
|
||||||
# test push
|
|
13
map.py
Normal file
13
map.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import pygame
|
||||||
|
|
||||||
|
# config
|
||||||
|
TILE_SIZE = 16
|
||||||
|
|
||||||
|
def preparedMap(screenSize):
|
||||||
|
tileImage = pygame.image.load('tile1.png')
|
||||||
|
surface = pygame.Surface(screenSize)
|
||||||
|
|
||||||
|
for x in range(0, screenSize[0], TILE_SIZE):
|
||||||
|
for y in range(0, screenSize[1], TILE_SIZE):
|
||||||
|
surface.blit(tileImage, (x, y))
|
||||||
|
return surface
|
Loading…
Reference in New Issue
Block a user