Page 1 of 1

[SOLVED] How to dynamically center an object

Posted: Sun May 07, 2017 1:30 pm
by CordCodes
I am new to LÖVE 2D and I am trying to dynamically center it. The forums and documentation I have gone through are not really clear and i sort of need this fast.

Thx, Oliver.

Re: How to dynamically center an object

Posted: Sun May 07, 2017 8:23 pm
by raidho36
Grab screen width and height, divide in half - that's the center. Then put your stuff in the center.

Re: How to dynamically center an object

Posted: Sun May 07, 2017 8:26 pm
by zorg
Images and the like are also positioned to their top-left corner, which is not specific to löve, that's how almost anything works with 2D graphics, by default... so if you want to center things, you might also need to subtract half of the dimensions of your object when positioning it for it to be centered with regards to itself.

(Also congrats Raidho for achieving a "leet" amount of posts :3)

Solved

Posted: Mon May 08, 2017 3:30 pm
by CordCodes
Thanks everyone, I got it now