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 os
import pygame import pygame
from agenci import * from agenci import *
from stale import * from stale import *
import stale
OKNO = pygame.display.set_mode((SZEROKOSC_OKNA, WYSOKOSC_OKNA)) OKNO = pygame.display.set_mode((SZEROKOSC_OKNA, WYSOKOSC_OKNA))
pygame.display.set_caption("Okno1") pygame.display.set_caption("Okno1")
Agenci1 = [] 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(): def wyswietl_okno():
OKNO.fill(JASNOSZARY1) OKNO.fill(JASNOSZARY1)
@ -18,14 +24,13 @@ def wyswietl_okno():
a.obierzNowyKierunek() a.obierzNowyKierunek()
a.okreslDlugoscDrogi() a.okreslDlugoscDrogi()
a.ruszSie(Agenci1) a.ruszSie(Agenci1)
kratka(OKNO)
pygame.display.update() pygame.display.update()
def dodaj_agenta1(): def dodaj_agenta1():
los = None los = None
if len(Agenci1) in range(0, 40): if len(Agenci1) in range(0, 1):
los = random.randint(1, 150)
elif len(Agenci1) in range(40, 50):
los = random.randint(1, 15) los = random.randint(1, 15)
if los != None: if los != None:
pom = None pom = None
@ -48,6 +53,14 @@ def dodaj_agenta1():
(BOK_AGENTA1, BOK_AGENTA1)) (BOK_AGENTA1, BOK_AGENTA1))
Agenci1.append(Agent1(hitbox, ikona, KIERUNEK.GORA, 0)) 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(): def main():
klatkaz = pygame.time.Clock() klatkaz = pygame.time.Clock()

View File

@ -2,13 +2,29 @@ from enum import Enum
FPS = 120 FPS = 120
KROK_AGENTA1 = 2 KROK_AGENTA1 = 2
SZEROKOSC_OKNA = 1280 SZEROKOSC_OKNA = 1080
WYSOKOSC_OKNA = 960 WYSOKOSC_OKNA = 760
BOK_AGENTA1 = 100 BOK_AGENTA1 = 100
BIALY = (255, 255, 255) BIALY = (255, 255, 255)
JASNOSZARY1 = (200, 200, 200) JASNOSZARY1 = (200, 200, 200)
ZIELONY1 = (26, 122, 26) 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): class KIERUNEK(Enum):
GORA = 0 GORA = 0