Hi, i'm new to love and i'm making a game similar to Realm of the Mad God. my maps are huge 2d arrays corresponding to arrays of quads and a tile atlas. ive covered the existing tutorials on the various methods of tile based scrolling, but they all lack any rotation. i've figured out how to create a "viewport" (rectangle) and move it out the screen, and only rendering the little square of the map that the viewport sees, and thats easy to do when you have a rectangle referencing to a matrix (basically flooring the xy of the top left corner and ceiling the bottom right and you have your ranges), but i cant figure out how to evaluate what is inside of a rotated rectangle.
PLEASE ASSIST <3,
Daniel
Efficient tile-based scrolling with rotation?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 3
- Joined: Sun Aug 19, 2012 10:48 pm
Re: Efficient tile-based scrolling with rotation?
Just do all your update stuff as if it was not rotated and then in the draw step rotate the entire draw operation with love.graphics.rotate.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
-
- Prole
- Posts: 3
- Joined: Sun Aug 19, 2012 10:48 pm
Re: Efficient tile-based scrolling with rotation?
thanks Lafolie, but that isnt what i need. when i do that it just rotates the rectangle of the screen arround the top left corner, or the x0y0 point. i need a way to rotate my viewport rectangle, not the actual screen. my viewport doesnt actually have anything to do with the drawing to the screen, its merely conceptual. it exists solely to tell the functions that determines what part of the map actually does get drawn to the screen. its like instead of moving the window (what the love.graphics transform functions do) i'm moving the world outside the window, except that whatever the window doesnt see doesnt actually exist as viewable data. i really need help more with matrices than graphics. once i can get the program to tell me what squares are inside its rotated rectangle, the rest is easy.
Re: Efficient tile-based scrolling with rotation?
Does this help? http://www.yaldex.com/games-programming ... sec10.html
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Re: Efficient tile-based scrolling with rotation?
It sounds like you're trying to rotate the camera itself. There are a number of camera implementations out there, for example in vrld's hump library.
Who is online
Users browsing this forum: Bing [Bot], Semrush [Bot] and 3 guests