Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  X and Y scrolling map?  (Read 897 times)
0 Members and 2 Guests are viewing this topic.
Offline jammas615

Jr. Member
**

Posts: 70



« on: 2011-12-27 07:21:29 »

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.

Offline tw0v

JGO n00b
*

Posts: 14



« Reply #1 on: 2011-12-27 07:23:14 »

is this a side scroller or an rpg aerial view?

Programming for better games.
Offline ra4king

JGO Kernel
*****

Posts: 3160
Medals: 196


I'm the King!


« Reply #2 on: 2011-12-27 08:02:26 »

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. Smiley

Games published by our own members! Go get 'em!
Offline jammas615

Jr. Member
**

Posts: 70



« Reply #3 on: 2011-12-27 15:07:33 »

It's an aerial view.

So I could implement world coordinates and offset the map using those.
     Is that efficient?

Offline ra4king

JGO Kernel
*****

Posts: 3160
Medals: 196


I'm the King!


« Reply #4 on: 2011-12-27 18:07:30 »

Yep but you shouldn't worry about efficiency until you actually implement something and notice a slowdown.

Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.082 seconds with 17 queries.