tmp
This commit is contained in:
parent
04927589c2
commit
84f33fd118
@ -5,7 +5,6 @@
|
|||||||
```yaml
|
```yaml
|
||||||
Modele:
|
Modele:
|
||||||
Smieciarka:
|
Smieciarka:
|
||||||
- Zbiera smieci
|
|
||||||
- posiada liste smieci (pojemnosc),
|
- posiada liste smieci (pojemnosc),
|
||||||
- zbiera smieci,
|
- zbiera smieci,
|
||||||
- segreguje smieci,
|
- segreguje smieci,
|
||||||
|
@ -24,3 +24,4 @@ home_amount = set_home_amount()
|
|||||||
|
|
||||||
PLAY_WIDTH = (home_amount+2)*CELL_SIZE
|
PLAY_WIDTH = (home_amount+2)*CELL_SIZE
|
||||||
PLAY_HEIGHT = PLAY_WIDTH
|
PLAY_HEIGHT = PLAY_WIDTH
|
||||||
|
HUD_HEIGHT = int(home_amount*CELL_SIZE/4)
|
||||||
|
BIN
fonts/Bazgroly.ttf
Normal file
BIN
fonts/Bazgroly.ttf
Normal file
Binary file not shown.
6
game.py
6
game.py
@ -1,8 +1,9 @@
|
|||||||
from pygame import *
|
from pygame import *
|
||||||
import sys
|
import sys
|
||||||
import random
|
import random
|
||||||
from config import PLAY_WIDTH, PLAY_HEIGHT, home_amount
|
from config import PLAY_WIDTH, PLAY_HEIGHT, HUD_HEIGHT, home_amount
|
||||||
from sprites.house import House
|
from sprites.house import House
|
||||||
|
from sprites.hud import Hud
|
||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
@ -20,8 +21,9 @@ obstacles_coords = []
|
|||||||
|
|
||||||
##GAMEWINDOW##########################
|
##GAMEWINDOW##########################
|
||||||
WINDOW_WIDTH = PLAY_WIDTH
|
WINDOW_WIDTH = PLAY_WIDTH
|
||||||
WINDOW_HEIGHT = PLAY_HEIGHT
|
WINDOW_HEIGHT = PLAY_HEIGHT + HUD_HEIGHT
|
||||||
GAMEWINDOW = display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT), 0, 32)
|
GAMEWINDOW = display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT), 0, 32)
|
||||||
|
hud = Hud(home_amount,WINDOW_WIDTH, WINDOW_HEIGHT,GAMEWINDOW)
|
||||||
display.set_caption('Smieciarz WMI')
|
display.set_caption('Smieciarz WMI')
|
||||||
icon = image.load('images/icon.png')
|
icon = image.load('images/icon.png')
|
||||||
display.set_icon(icon)
|
display.set_icon(icon)
|
||||||
|
24
sprites/hud.py
Normal file
24
sprites/hud.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import pygame
|
||||||
|
from config import HUD_HEIGHT
|
||||||
|
HUD_COLOR = (51,21,4)
|
||||||
|
WHITE = (255,255,255)
|
||||||
|
class Hud():
|
||||||
|
texts = []
|
||||||
|
def __init__(self,house_amount,WINDOW_WIDTH, WINDOW_HEIGHT,GAMEWINDOW):
|
||||||
|
pygame.init()
|
||||||
|
hud_upper = WINDOW_WIDTH - HUD_HEIGHT
|
||||||
|
hud_lower = WINDOW_WIDTH
|
||||||
|
height = hud_upper - hud_lower
|
||||||
|
font_type = 'fonts/Bazgroly.ttf'
|
||||||
|
font_size = house_amount * 2
|
||||||
|
GAMEWINDOW.fill(HUD_COLOR)
|
||||||
|
font = pygame.font.Font(font_type, font_size)
|
||||||
|
|
||||||
|
gc_plastic_text = font.render("Plastic: 0/0",True,WHITE)
|
||||||
|
gc_metal_text = font.render("Metal: 0/0",True,WHITE)
|
||||||
|
gc_glass_text = font.render("Glass: 0/0",True,WHITE)
|
||||||
|
map_plastic_text = font.render("Plastic: 0",True,WHITE)
|
||||||
|
map_metal_text = font.render("Metal: 0",True,WHITE)
|
||||||
|
map_glass_text = font.render("Glass: 0",True,WHITE)
|
||||||
|
overall_text = font.render("Garbage thrown away: 0",True,WHITE)
|
||||||
|
GAMEWINDOW.blit(overall_text,(20, 20))
|
Loading…
Reference in New Issue
Block a user