• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Looking at basic game design

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
If you are using a rototiller, you are doing it wrong. Even on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic