Adds an obstacle generation system

This system is responsible for generating obstacles and moving them on-screen as the player moves in the world.
This commit is contained in:
William Hubbard
2023-02-04 10:49:04 -07:00
parent f87b73fb9b
commit a218536601
2 changed files with 159 additions and 0 deletions

26
map.py Normal file
View File

@@ -0,0 +1,26 @@
from typing import List, Tuple
class ObstacleSlice:
"""
The game world is divided up into distinct "slices," where each slice is a predefined set of
obstacles in specific positions. These slices are then put forward in random order
"""
"""
How many units an obstacle slice is
"""
height=20
def __init__(self, obstacle_map: List[Tuple[int]], difficulty: int):
"""
Creates an obstacle slice
:param obstacle_map:
A two-dimensional list description what obstacles are here. Each tuple describes a
single obstacle, its x, and y position, the obstacle type, the x mirror, and the y
mirror.
:param difficulty:
The difficulty of the game. This influences when this slice appears.
"""
self.obstacle_map = obstacle_map
self.difficulty = difficulty