Sprite Rotating Function by ThomasFN26th May 2008 9:02
|
---|
Summary Allows sprites to be rotated around a point of origin. Description This function uses trig to rotate a sprite about a point of origin, rather than about the top left corner (as supplies by Rotate Sprite function). Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com DoSprite( SpriteNumber, XPos, YPos, Imagenumber, PointOfOriginX, PointOfOriginY, ValueToRotateBy ) Function DoSprite(SpriteNumber, XPos, YPos, ImageNumber, OriginX, OriginY, Rotation) d# = Sqrt(OriginX^2 + OriginY^2) a# = 180+atanfull(OriginX,OriginY) nx# = (d# * (cos(a# + Rotation))) + XPos ny# = (d# * (sin(a# + Rotation))) + YPos Sprite SpriteNumber, nx#, ny#, ImageNumber Rotate Sprite SpriteNumber, Rotation EndFunction |