Login | Register

Sprite origin

October 4, 2006, 20:29 by Calle
[loading]
-->
<b>Question:</b> Changeing The X,y Orgin?, possible?
is it this command?
sprite_set_offset(ind,xoff,yoff) Sets the offset of the sprite with the given index.

because im adding sprites externally so... and i want the sprites to have a centered orgin.

<b>Answer:</b> First of all, you shouldn't need to ask whether or not you solution is correct. You could try it yourself! It is very likely that sprite_sett_offset would work, very likely.

Secondly, if you can't find a certain function in the manual it doesn't exist, therefore you will have to look over other solutions:


x = x + sprite_width/2;
y = y + sprite_height/2;


That of above is good, when placed in step event it would exactly such as if the origin was centered. If you add x+offset, y+offset, on all your positions, that'd be exactly the same thing as actually having an offset.

Comments

Loading comments... [loading]
.
Users logged in:

game maker articles, game maker examples, game maker tutorials, gmtutorials, game maker questions and answers, game maker crash course, how to create games