Skip to content

Instantly share code, notes, and snippets.

@rollerozxa
Last active March 8, 2022 09:07
Show Gist options
  • Save rollerozxa/60bef453633dd7846bae435cd2129f5c to your computer and use it in GitHub Desktop.
Save rollerozxa/60bef453633dd7846bae435cd2129f5c to your computer and use it in GitHub Desktop.
ball = world:get_entity(3)
box = world:get_entity(2)
function step(count)
if ball and box then
local ball_x,ball_y = ball:get_position()
local box_x,box_y = box:get_position()
local juli = math.sqrt((ball_x-box_x)*(ball_x-box_x)+(ball_y-box_y)*(ball_y-box_y))
if juli < 0.9 then
ball:absorb()
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment