Skip to content

Loading…

Removes bounce at edge of polygons #1230

Merged
merged 3 commits into from

3 participants

@CalebJohn
Journey to the Center of Hawkthorne member

fixes #1223

turns out what was happening was at thin parts the polyline wasnt being treated as such so it was moving the maximum height of the polyline

@CalebJohn
Journey to the Center of Hawkthorne member

this fixes #1223 and the trombone skipping but it aggravates a bug where the player shakes at the tip of a triangle. im going to take a look later to see what causes that

@CalebJohn
Journey to the Center of Hawkthorne member

This should cover everything i can't find anymore bugs

@phamdaniel
Journey to the Center of Hawkthorne member

Tested and it seems fixed :D

@didory123
Journey to the Center of Hawkthorne member

Looks very good to me. Merging

@didory123 didory123 merged commit e584c5b into hawkthorne:master

1 check passed

Details default The Travis build passed
@CalebJohn CalebJohn deleted the CalebJohn:polygon-fix branch
@phamdaniel phamdaniel referenced this pull request
Closed

Castle Hawkthorne #982

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2013
  1. @CalebJohn

    fixes weird bounce

    CalebJohn committed
  2. @CalebJohn
Commits on Apr 10, 2013
  1. @CalebJohn

    No more bouncing

    CalebJohn committed
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/nodes/platform.lua
View
19 src/nodes/platform.lua
@@ -71,14 +71,19 @@ function Platform:collide( node, dt, mtv_x, mtv_y, bb )
local px1, py1, _, _ = node.top_bb:bbox()
local _, _, px2, py2 = node.bottom_bb:bbox()
local distance = math.abs(node.velocity.y * dt) + 2.10
-
- if self.bb.polyline
- and node.velocity.y >= 0
- -- Prevent the player from being treadmilled through an object
- and ( self.bb:contains(px2,py2) or self.bb:contains(px1,py2) ) then
+
+ if self.bb.polyline and node.velocity.y >= 0 then
+ -- If the player is close enough to the tip bring the player to the tip
+ if math.abs(wy1 - py2) < 2 then
+ node:floor_pushback(self, wy1 - node.height)
+
+ -- Prevent the player from being treadmilled through an object
+ elseif self.bb:contains(px2,py2) or self.bb:contains(px1,py2) then
- -- Use the MTV to keep players feet on the ground,
- node:floor_pushback(self, py1 + mtv_y)
+ -- Use the MTV to keep players feet on the ground
+ node:floor_pushback(self, (py2 - node.height) + mtv_y)
+
+ end
elseif node.velocity.y >= 0 and math.abs(wy1 - py2) <= distance then
node:floor_pushback(self, wy1 - node.height)
Something went wrong with that request. Please try again.