(AGK version: 108.14)
Submitted: 2014-03-02 22:09:42
setVirtualResolution(640,480)


n = createSprite(0)
setSpriteSize(n , 100, 20)
setSpriteColor(n, 255, 0, 0, 255)
setSpritePhysicsOn(n, 2)

n2 = createSprite(0)
setSpriteSize(n2 , 100, 20)
setSpriteColor(n2, 0, 255, 0, 255)
setSpritePosition(n2, 120, 0)
setSpritePhysicsOn(n2, 2)

createMouseJoint(n, 0, 10, 25000)


createWeldJoint(n, n2, 100, 10, 0)


setPhysicsDebugOn()


repeat

    x = getPointerX()
    y = getPointerY()

    SetJointMouseTarget(n, x, y)




    drawLine(x, y, getSpriteXByOffset(n), getSpriteYByOffset(n), 255, 0, 0)





    sync()
until getRawKeyPressed(27) = 1
end
Help make AGK better by submitting an example for this command!
(All examples are subject to approval)
Login to post an example of your own.