Skip to content

Commit

Permalink
Clean up level so balloons are more accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicfreeston committed May 25, 2023
1 parent ee8e592 commit 328c369
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions mygame/app/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,29 @@ def reset_level
}

state.platforms = generate_platforms

# clean up level, stopping power_ups from intersecting

power_ups = state.platforms.filter do |p|
p.power_up
end.map do |p|
p = p.dup
p.h = 100
p.anchor_y = 0
p
end

state.platforms.filter! do |p|
p.power_up || (not geometry.find_intersect_rect p, power_ups)
end

state.broken_platforms = []

state.goal = {
x: grid.center.x,
y: state.platforms.last.y + 100,
w: 80,
h: 80,
y: state.platforms.last.y + 300,
w: 128,
h: 128,
path: SPATHS.goal
}

Expand Down

0 comments on commit 328c369

Please sign in to comment.