This commit is contained in:
Waylon Walker 2023-07-01 13:51:57 -05:00
parent 32c78767df
commit c3b1f40a58
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
3 changed files with 46 additions and 25 deletions

View file

@ -36,7 +36,11 @@ class Map:
self.persistence = 0.05 # Amplitude of each octave
self.lacunarity = 1.0 # Frequency of each octave
self.thresh = 125
self.pre_draw()
# try to load the map from map.png
try:
self.surf = pygame.image.load("map.png").convert_alpha()
except FileNotFoundError:
self.pre_draw()
def refresh_surf(self):
@ -66,6 +70,7 @@ class Map:
def pre_draw(self):
self.refresh_surf()
for x in range(int(self.screen_width)):
for y in range(int(self.screen_height)):
if not self.point_check_collision(x, y):
@ -80,6 +85,7 @@ class Map:
),
)
pygame.image.save(self.surf, "map.png")
# av1 = (
# Image.open("rock.jpg")
# .convert("RGB")