Looks good to me... Usage example:
// Project: followtest
// Created: 2015-10-27
// set window properties
SetWindowTitle( "followtest" )
SetWindowSize(300,300,0)
// set display properties
SetVirtualResolution( 100, 100 )
SetOrientationAllowed( 1, 1, 1, 1 )
p1 = createsprite(createimagecolor(255,50,50,255))
setspritesize(p1,10,10)
SetSpritePosition(p1,50,50)
p2 = CreateSprite(CreateImageColor(50,255,50,255))
SetSpriteSize(p2,5,5)
rotate# = 0.0
do
rotate#=rotate#+2.1
SetSpriteAngle(p1,rotate#)
FollowSprite(p2,p1,15,15)
Print( ScreenFPS() )
Sync()
loop
function FollowSprite(SpriteID,ParentID,OffsetX#,OffsetY#)
a# = GetSpriteAngle(ParentID)
x# = GetWorldXFromSprite( ParentID, OffsetX#, OffsetY# )
y# = GetWorldYFromSprite( ParentID, OffsetX#, OffsetY# )
SetSpriteAngle(SpriteID,a#)
SetSpritePositionByOffset(SpriteID, x#,y#)
endfunction