Working with multiple trashes

This commit is contained in:
Krzysztof Surażyński 2021-04-18 10:55:36 +02:00
parent ae75adf143
commit b2cd21b5d8
3 changed files with 2 additions and 4 deletions

View File

@ -1,7 +1,7 @@
FPS = 30 FPS = 30
DEFAULT_ASSET_SIZE = 64 DEFAULT_ASSET_SIZE = 64
DEFAULT_MAP_SIZE = 16 DEFAULT_MAP_SIZE = 12
WINDOW_HEIGHT = DEFAULT_ASSET_SIZE * DEFAULT_MAP_SIZE WINDOW_HEIGHT = DEFAULT_ASSET_SIZE * DEFAULT_MAP_SIZE
WINDOW_WIDTH = DEFAULT_ASSET_SIZE * DEFAULT_MAP_SIZE WINDOW_WIDTH = DEFAULT_ASSET_SIZE * DEFAULT_MAP_SIZE

View File

@ -2,7 +2,6 @@ import random
import pygame import pygame
from config import * from config import *
from src.entitie.Obs import Obs from src.entitie.Obs import Obs
from src.entitie.Space import Space from src.entitie.Space import Space
@ -13,7 +12,7 @@ from src.entitie.Truck import Truck
class EnvMap: class EnvMap:
def generate_map_field(self, x, y): def generate_map_field(self, x, y):
random_index = random.randint(0, 100) random_index = random.randint(0, 100)
if random_index == -1: if random_index < 5:
return Trash(x, y) return Trash(x, y)
elif random_index < 80: elif random_index < 80:
return Space(x, y) return Space(x, y)
@ -25,7 +24,6 @@ class EnvMap:
for x in range(DEFAULT_MAP_SIZE): for x in range(DEFAULT_MAP_SIZE):
temp_map.append([self.generate_map_field(x, y) for y in range(16)]) temp_map.append([self.generate_map_field(x, y) for y in range(16)])
temp_map[12][14] = Trash(12, 14)
self.map = temp_map self.map = temp_map
def import_map(self, map): def import_map(self, map):