added landfill class
This commit is contained in:
parent
35fa5f5558
commit
af54b7283f
7
game.py
7
game.py
@ -2,6 +2,7 @@ from pygame import *
|
|||||||
import sys, random
|
import sys, random
|
||||||
from sprites.grass import Grass
|
from sprites.grass import Grass
|
||||||
from sprites.house import House
|
from sprites.house import House
|
||||||
|
from sprites.landfill import Landfill
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ fps_clock = time.Clock()
|
|||||||
#Tu będzie zmienna do wybrania przez użytkownika na start/ do zmiany w trakcie "gry"
|
#Tu będzie zmienna do wybrania przez użytkownika na start/ do zmiany w trakcie "gry"
|
||||||
home_amount = utils.set_home_amount()
|
home_amount = utils.set_home_amount()
|
||||||
|
|
||||||
|
|
||||||
#Obszar przeznaczony na płyki
|
#Obszar przeznaczony na płyki
|
||||||
PLAY_WIDTH = (home_amount+1)*64
|
PLAY_WIDTH = (home_amount+1)*64
|
||||||
PLAY_HEIGHT = PLAY_WIDTH
|
PLAY_HEIGHT = PLAY_WIDTH
|
||||||
@ -33,6 +35,11 @@ for x in range(PLAY_HEIGHT//64):
|
|||||||
grass = Grass(x,y)
|
grass = Grass(x,y)
|
||||||
cells[x].append(grass)
|
cells[x].append(grass)
|
||||||
|
|
||||||
|
for x in range(PLAY_HEIGHT//64):
|
||||||
|
cells.append([])
|
||||||
|
for y in range(PLAY_HEIGHT//64):
|
||||||
|
grass = Grass(x,y)
|
||||||
|
cells[x].append(grass)
|
||||||
|
|
||||||
#Losowanie domków i dodawanie je do mapy
|
#Losowanie domków i dodawanie je do mapy
|
||||||
home_len = home_amount
|
home_len = home_amount
|
||||||
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
10
sprites/landfill.py
Normal file
10
sprites/landfill.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import pygame
|
||||||
|
import sys
|
||||||
|
from sprites.cell import Cell
|
||||||
|
|
||||||
|
class Landfill(Cell):
|
||||||
|
def __init__(self, x, y, type):
|
||||||
|
types = ["plastic", "glass", "metal"]
|
||||||
|
self.type = types[type]
|
||||||
|
Cell.__init__(self,x,y)
|
||||||
|
self.image = pygame.image.load("images/landfill_%s.png" %(self.type))
|
Loading…
Reference in New Issue
Block a user