From 71cf238e65ff10f50ee0588c40e8ab711ded68f8 Mon Sep 17 00:00:00 2001 From: Aniela Date: Sat, 19 Mar 2022 14:46:39 +0100 Subject: [PATCH] m --- main.py => main2.py | 21 +++++++++++++++++---- stale.py | 22 +++++++++++++++++++--- 2 files changed, 36 insertions(+), 7 deletions(-) rename main.py => main2.py (71%) diff --git a/main.py b/main2.py similarity index 71% rename from main.py rename to main2.py index 2a2409e..9115ef6 100644 --- a/main.py +++ b/main2.py @@ -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() diff --git a/stale.py b/stale.py index 7e36106..0fcf1b9 100644 --- a/stale.py +++ b/stale.py @@ -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