Skip to content

Commit

Permalink
feat: add init_pymunk_poly to ground interface
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasfremming committed Nov 5, 2024
1 parent 2bc4923 commit a76e280
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ground.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def calculate_y(self, x: int) -> int:
@property
def update(self):
pass

@property
def init_pymunk_polygon(self, space):
pass


class BasicSegment():
Expand Down Expand Up @@ -235,6 +239,9 @@ def move_segments(self, scroll_offset: float) -> None:
for segment in self.terrain_segments:
segment.body.position = (segment.body.position[0] - scroll_offset, segment.body.position[1])

def init_pymunk_polygon(self, space) -> None:
for segment in self.terrain_segments:
segment.init_pymunk_polygon(space)

class PerlinSegment():
def __init__(self, start_x: int, end_x: int) -> None:
Expand All @@ -253,7 +260,6 @@ def init_pymunk_polygon(self, space) -> None:
poly = pymunk.Poly(body, self.points, radius=0.0)
space.add(body, poly)


class PerlinNoise():

def __init__(
Expand Down

0 comments on commit a76e280

Please sign in to comment.