is there a command to set the point on a sprite that it draws from ?
i.e normally it'll draw the sprite from 0,0 but i would like the drawing position
to be the centre or 10,10 etc
Thanks
okee
Use GRABSPRITE to a temporary sprite ID and draw that!
You can make a simple function that draws the sprite on whatever hotspot you want. Use GETSPRITESIZE to get the size of the sprite
FUNCTION DrawSprite2: id, x, y
LOCAL w, h
LOCAL hotspotx, hotspoty
GETSPRITESIZE id, w, h
IF w>0 AND h>0
// If you want centered hotspot:
hotspotx = w/2
hotspoty = h/2
// New position of draw
x = x - hotspotx
y = y - hotspoty
DRAWSPRITE id, x, y
ENDIF
ENDFUNCTION
(untested :-)
I usually keep my sprites in types - something like objects, characters, etc.
Then I put offset x/y field in type definitions for exactly these purposes. Basically a variation of what Moru said.
character AS TCharacter
character.offset_x = 16
character.offset_y = 32
num = character.spritenum
x = x - character.offset_x
y = y - character.offset_y
DRAWSPRITE num, x, y
Yeah I'm using types anyway the store the objects so shouldn't be too much trouble adjust their
draw coordinates, just thought there might be some command i was overlooking.