def free(rng): actor = logic.globalDict["actor"] actorPosition = getPosition.onGround(actor["position"]) # targetOffset - Offset from actor in form [x,y] for targetOffset in rng["range"]: targetX = actorPosition[0] + targetOffset[0] targetY = actorPosition[1] + targetOffset[1] targetSpace = [targetX, targetY] storeValidSpace.attempt(actorPosition, targetSpace, rng)
def rigid(rng): actor = logic.globalDict["actor"] actorPosition = getPosition.onGround(actor["position"]) # Point in each of 4 cardinal directions # NOTE(kgeffen) Start with space rotated by quarter circle from front, # go to space rotated by half circle, etc. # Order matters! for dv in ([1, 0], [0, -1], [-1, 0], [0, 1]): # Rotate range by 90 degrees # Ex: special space [2,0] becomes [0,-2] rotateRange(rng) # targetOffset - Offset from space on given side of actor (space = actorPosition + dv) for targetOffset in rng["range"]: targetX = actorPosition[0] + targetOffset[0] + dv[0] targetY = actorPosition[1] + targetOffset[1] + dv[1] targetSpace = [targetX, targetY] storeValidSpace.attempt(actorPosition, targetSpace, rng)