Efficient tile-based scrolling with rotation?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
thecontrarian42
Prole
Posts: 3
Joined: Sun Aug 19, 2012 10:48 pm

Efficient tile-based scrolling with rotation?

Post by thecontrarian42 »

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
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Efficient tile-based scrolling with rotation?

Post by Lafolie »

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.
thecontrarian42
Prole
Posts: 3
Joined: Sun Aug 19, 2012 10:48 pm

Re: Efficient tile-based scrolling with rotation?

Post by thecontrarian42 »

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.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Efficient tile-based scrolling with rotation?

Post by Lafolie »

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.
User avatar
kexisse
Citizen
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Efficient tile-based scrolling with rotation?

Post by kexisse »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests