Game Tile Layout Help

A

andrew arthur

Hi guys,

I'm starting my first Java game, and need some help with the graphics. It's
going to be an RPG on a tile-based 2D map. Here's what I have so far:

About 20 PNG files (50x50) // these will be the tiles
A Tile class which extends JFrame and displays a PNG file
A Map class which creates the map as an int[30][30] array // the value of
the int determines what tile will be displayed

I want the GUI to show only the 400x300 area surrounding the player.

Question 1: Is JFrame the best way to represent a tile?
Question 2: What's the best way to lay out the tiles?

Cheers,

Sean
 
A

Andrew Thompson

On Tue, 8 Jun 2004 17:09:43 +0100, andrew arthur wrote:

Question 0: What's the best group for GUI questions?

<http://www.physci.org/codes/javafaq.jsp#cljg>
But not before reading the FAQ..
Question 1: Is JFrame the best way to represent a tile?

No. Not unless you need to have them
floating free of each other.

Usually it is best to make your top
level component a Container or (J)Panel.

That way you can put it in a JApplet,
JFrame or JWindow as need be.
Question 2: What's the best way to lay out the tiles?

GridLayout for the 30x30 array,
possibly nested in a border layout
with controls/readout etc. in
NORTH, SOUTH, EAST, WEST.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top