Hey,
I’m trying to think of ways to implement a 2d tiled map that scrolls along the x and y axis.
Does anyone have any ideas or know methods of doing this?
Thanks.
Hey,
I’m trying to think of ways to implement a 2d tiled map that scrolls along the x and y axis.
Does anyone have any ideas or know methods of doing this?
Thanks.
is this a side scroller or an rpg aerial view?
Have an xOffset and a yOffset variable and you use those to “offset” the world by adding them to the X and Y of all entities when rendering.
This is usually done by a Camera class that has just those two variables and you have that Camera object available to all Entities when they’re rendering.
Another way is to just call Graphics2D.translate(xOffset,yOffset) right before you render all the entities.
It’s an aerial view.
So I could implement world coordinates and offset the map using those.
Is that efficient?
Yep but you shouldn’t worry about efficiency until you actually implement something and notice a slowdown.