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.
[SOLVED] How to dynamically center an object
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
[SOLVED] How to dynamically center an object
Last edited by CordCodes on Mon May 08, 2017 3:31 pm, edited 1 time in total.
Re: How to dynamically center an object
Grab screen width and height, divide in half - that's the center. Then put your stuff in the center.
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How to dynamically center an object
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 )
(Also congrats Raidho for achieving a "leet" amount of posts )
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: No registered users and 3 guests