i believe you're trying to do this?
SetVirtualResolution(1024,768)
SetSyncRate(60,1)
//create the bar to hold the ball and chain
bar1 = CreateSprite(0)
SetSpriteSize(bar1,10,260)
SetSpritePositionByOffset(bar1,512,500)
SetSpritePhysicsOn(bar1,1)
//create the chain
chain = CreateSprite(0)
SetSpriteSize(chain,10,80)
SetSpritePositionByOffset(chain,512,GetSpriteY(bar1)-(GetSpriteHeight(chain)*0.5))
SetSpriteColor(chain,255,0,0,255)
SetSpriteCollideBit(chain,2,0)
SetSpritePhysicsOn(chain,2)
//join the bar and chain
joint1 = CreateRevoluteJoint( bar1, chain, 512, GetSpriteY(bar1), 0 )
//create the ball on the end of the chain
ball = CreateSprite(0)
SetSpriteSize(ball,30,30)
SetSpritePositionByOffset(ball,512,GetSpriteY(chain)-(GetSpriteHeight(ball)*0.5))
SetSpritePhysicsOn(ball,2)
//join the ball and the chain
CreateRevoluteJoint( ball, chain, 512, GetSpriteY(chain), 0 )
//create the floor
ground = CreateSprite(0)
SetSpriteSize(ground,1024,268)
SetSpritePosition(ground,0,500)
SetSpritePhysicsOn(ground,1)
SetSpriteCollideBit(ball,2,1)
SetSpriteCollideBit(ball,1,0)
SetJointMotorOn( joint1, 1000, 10000)
//create a falling box for the ball to hit while swinging
box = CreateSprite(0)
SetSpriteCategoryBit(box,2,1)
SetSpriteCategoryBit(box,1,0)
SetSpriteSize(box,20,20)
repeat
temp = random2(412,612)
until temp <> 512
SetSpritePositionByOffset(box,temp,200)
SetSpritePhysicsOn(box,2)
do
if GetRawKeyPressed(27) then end
if GetSpriteCollision(ground,box)
repeat
temp = random2(412,612)
until temp <> 512
SetSpritePositionByOffset(box,temp,200)
endif
sync()
loop
i'm not an expert by any means but it looks good to me.
if you don't want the ball to rotate around on it's own axis then use a different type of joint as bengismo says
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu