Hello,
Could anyone please explain to me how this damn thing work? I'm used to objects. And this rotate function is rotating everything, i just want it to rotate the "Zeme".. the blue planet.
Thanks.
Rotate
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Rotate
Wrap your code with the push and pop functions.
Heres the pseudo code:
lg = love.graphics
lg.push()
lg.translate()
lg.rorate()
--draw blue planet
lg.translate()
lg.pop()
--Draw the rest
Heres the pseudo code:
lg = love.graphics
lg.push()
lg.translate()
lg.rorate()
--draw blue planet
lg.translate()
lg.pop()
--Draw the rest
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Rotate
Graphical transformations affect all subsequent rendering, it's pretty simple. The aforementioned "pop" and "push" functions can be used to load and save current transform state, respectively.
Re: Rotate
I'm really sorry but i still don't understand how it works
Re: Rotate
Well I suppose you can imagine it as a stretchy painting canvas. You can stretch and twist and rotate it then draw things on it, then twist and stretch again and draw some more, etc. Then in the end you put the canvas back as it was, and everything you drew as normal would be accordingly twosted and stretched.
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Rotate
As raidho said, use the push and pop functions. Similar to what ive posted before
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Re: Rotate
The love.graphics.push() function stores any transformations as they are now, and the love.graphics.pop() function reverts transformations back to how they were when you called the push function.
E.g. you call love.graphics.push(), apply your transformations, draw your things and then call pop() and draw the things you want to be drawn normally.
Here's a small example (might contains typos, typed this out of my head)
Code: Select all
-- anything drawn here will be drawn normally
-- store current transformations
love.graphics.push()
-- apply your transformations
love.graphics.translate(.5, .5)
love.graphics.rotate(90)
-- anything drawn here will have the transformations applied to them
-- reset transformations
love.graphics.pop()
-- anything drawn here will be drawn normally
love.graphics.pop
love.graphics.push
Re: Rotate
If you're not comfortable with push/pop, don't use it.
- Attachments
-
- popless.love
- Simple example
- (555 Bytes) Downloaded 128 times
- zorg
- Party member
- Posts: 3470
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Rotate
Probably the same way with them, except you need to reset the state you modified... if you only used coordinate transform stuff, then there's a neat little love.graphics.origin function for that.
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: Ahrefs [Bot], Bing [Bot] and 2 guests