Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looking at basic game design

 
Gaz Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1309
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic