Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function concaveGroundTransition(heading, direction)
- local bounds = boundingBox()
- local wallCheckRegion = {
- bounds[1] + heading[1] + 0.125,
- bounds[2] + heading[2] + 0.125,
- bounds[3] + heading[1] - 0.125,
- bounds[4] + heading[2] - 0.125
- }
- -- Walls must be higher than one block off the ground
- if self.groundDirection[1] < 0 then
- wallCheckRegion[1] = wallCheckRegion[1] + 1.0
- elseif self.groundDirection[1] > 0 then
- wallCheckRegion[3] = wallCheckRegion[3] - 1.0
- end
- if self.groundDirection[2] < 0 then
- wallCheckRegion[2] = wallCheckRegion[2] + 1.0
- elseif self.groundDirection[2] > 0 then
- wallCheckRegion[4] = wallCheckRegion[4] - 1.0
- end
- if world.rectTileCollision(wallCheckRegion, "Dynamic") then
- if setGroundDirection(heading) then
- heading = headingFromDirection(direction)
- world.logInfo("hit wall at %q", heading)
- return heading
- end
- end
- return nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement