This commit is contained in:
Aniela 2022-03-19 14:46:39 +01:00
parent 61c8f63437
commit 71cf238e65
2 changed files with 36 additions and 7 deletions

View File

@ -1,14 +1,20 @@
import os
import pygame
from agenci import *
from stale import *
import stale
OKNO = pygame.display.set_mode((SZEROKOSC_OKNA, WYSOKOSC_OKNA))
pygame.display.set_caption("Okno1")
Agenci1 = []
def kratka(surface):
for i in range(stale.NUMBER_OF_BLOCKS_WIDE):
new_height=round(i*BLOCK_HEIGHT)
new_width =round(i*BLOCK_HEIGHT)
pygame.draw.line(surface, BLACK,(0,new_height),(SZEROKOSC_OKNA,new_height),2)
pygame.draw.line(surface,BLACK,(new_width,0),(new_width,WYSOKOSC_OKNA),2)
def wyswietl_okno():
OKNO.fill(JASNOSZARY1)
@ -18,14 +24,13 @@ def wyswietl_okno():
a.obierzNowyKierunek()
a.okreslDlugoscDrogi()
a.ruszSie(Agenci1)
kratka(OKNO)
pygame.display.update()
def dodaj_agenta1():
los = None
if len(Agenci1) in range(0, 40):
los = random.randint(1, 150)
elif len(Agenci1) in range(40, 50):
if len(Agenci1) in range(0, 1):
los = random.randint(1, 15)
if los != None:
pom = None
@ -48,6 +53,14 @@ def dodaj_agenta1():
(BOK_AGENTA1, BOK_AGENTA1))
Agenci1.append(Agent1(hitbox, ikona, KIERUNEK.GORA, 0))
def dodaj_agenta2():
los = None
if len(Agenci1) in range(0, 1):
los = random.randint(1, 15)
pom = 'wozek.png'
if pom != None:
x, y = random.randint(0, SZEROKOSC_OKNA - BOK_AGENTA1), random.randint(0, WYSOKOSC_OKNA - BOK_AGENTA1)
hitbox = pygame.Rect(x, y, BOK_AGENTA1, BOK_AGENTA1)
def main():
klatkaz = pygame.time.Clock()

View File

@ -2,13 +2,29 @@ from enum import Enum
FPS = 120
KROK_AGENTA1 = 2
SZEROKOSC_OKNA = 1280
WYSOKOSC_OKNA = 960
SZEROKOSC_OKNA = 1080
WYSOKOSC_OKNA = 760
BOK_AGENTA1 = 100
BIALY = (255, 255, 255)
JASNOSZARY1 = (200, 200, 200)
ZIELONY1 = (26, 122, 26)
GREY =(150,150,150)
RED =(255,0,0)
BLUE=(55,55,255)
BLACK =(0,0,0)
GREEN =(0,200,0)
DARKGREY=(150,150,150)
UGLY_PINK=(255,0,255)
BROWN=(153,76,0)
GOLD=(153,153,0)
DARKGREEN=(0,102,0)
DARKORANGE=(255,128,0)
NUMBER_OF_BLOCKS_WIDE=8
NUMBER_OF_BLOCKS_HIGH=8
BLOCK_HEIGHT=round(SZEROKOSC_OKNA/NUMBER_OF_BLOCKS_HIGH)
BLOCK_WIDTH=round(WYSOKOSC_OKNA/NUMBER_OF_BLOCKS_WIDE)
MAPFILE="map.txt"
TITLE ="Gierka"
class KIERUNEK(Enum):
GORA = 0