Advertisement
Guest User

Untitled

a guest
May 23rd, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. function concaveGroundTransition(heading, direction)
  2. local bounds = boundingBox()
  3.  
  4. local wallCheckRegion = {
  5. bounds[1] + heading[1] + 0.125,
  6. bounds[2] + heading[2] + 0.125,
  7. bounds[3] + heading[1] - 0.125,
  8. bounds[4] + heading[2] - 0.125
  9. }
  10. -- Walls must be higher than one block off the ground
  11. if self.groundDirection[1] < 0 then wallCheckRegion[1] = wallCheckRegion[1] + 1.0 end
  12. if self.groundDirection[1] > 0 then wallCheckRegion[3] = wallCheckRegion[3] - 1.0 end
  13. if self.groundDirection[2] < 0 then wallCheckRegion[2] = wallCheckRegion[2] + 1.0 end
  14. if self.groundDirection[2] > 0 then wallCheckRegion[4] = wallCheckRegion[4] - 1.0 end
  15.  
  16. if world.rectTileCollision(wallCheckRegion, "Dynamic") then
  17. if setGroundDirection(heading) then
  18. util.debugLog("hit wall at %s", heading)
  19. heading = headingFromDirection(direction)
  20. end
  21. end
  22.  
  23. return heading
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement