Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Offset Sprite Function..

Author
Message
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 27th Nov 2002 00:39
..could be better but hey, there ya go. Uses image 9999 to work out and return either half the width or half the height, combined you can set the sprite offset so 0,0 is the middle of the sprite.

Usage Example -

offset sprite 1,getoffset("x",11),getoffset("y",11)

Function -

function getoffset(xory$,image)
if sprite exist(9999)=1 then delete sprite 9999
sprite 9999,0,0,image
if xory$="x" then returnval=sprite width(9999)/2
if xory$="y" then returnval=sprite height(9999)/2
delete sprite 9999
endfunction returnval

Login to post a reply

Server time is: 2024-04-19 17:27:33
Your offset time is: 2024-04-19 17:27:33