-
-
Save rollerozxa/60bef453633dd7846bae435cd2129f5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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