This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Game Development and the fly likes Looking at basic game design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Looking at basic game design" Watch "Looking at basic game design" New topic
Author

Looking at basic game design

Gaz Johnson
Greenhorn

Joined: Apr 27, 2009
Posts: 22
I have been trying to implement a basic game. However, i'm relatively new to java and not sure the best way to go about it.

I am going to have a background image as the board and then draw the counters on top of this image to represent their position. When moves occur I will make the movements animated rather than jumping from position 1 --> postion 2.

What is the best way to do this? I initially had a JFrame with the background image handled by a JFrame. However, I couldn't then get the counters to draw on the frame.

Thankyou in advance for any support/ help you might be able to supply.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> What is the best way to do this? I initially had a JFrame with the background image handled by a JFrame.

using a JFrame is the wrong approach - it is a top-level window

if you use a JPanel, you can then add it to just about anything - frame, applet etc
Gaz Johnson
Greenhorn

Joined: Apr 27, 2009
Posts: 22
Thankyou. Is it good practice to have more than one frame? For example i'l have a game window and one or two control panels. If i creates these within JPanels and add these to different JFrames.... is this considered good practice?
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

first of all i recommend to move this topic to the gaming forum for a better response.

usually its not good to use more than 1 frame in such applications, i would recommend a modal dialog for such purposes

The best way to do that i guess is to make a layout model that supports a grid like positioning
it may contain a move method which will move component from one cell location to another
you can later do the work of animating the movement.

I have myself made a similar game in java at my site, its called snakes and ladders.
though i have not used animations for the cell to cell movement as you require,
i think it may give you an idea.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

salvin francis wrote:first of all i recommend to move this topic to the gaming forum for a better response.

You know what? That's a great idea! Moving...


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Looking at basic game design
 
Similar Threads
Component Order
Jumpy program
Creating my first game
First Java Game - Help REALLY appreciated
game animation ( 2d )