• 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

Java 2d game experiment guideline

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, im learning java2d, and was given a smal game to develope, but im strugling with a part of the game, above i leave a screenshot of the result.

http://i.imgur.com/CTPg6od.jpg

Basically in all these cards i have to find 3 cards that match, in my case gradient blue, and in 3 matches i have 4 opportunities, and always tha i choose the right card it appears a smily face, and if a choose the wrong card appears a sad face icon. So my strugle is, for the Cards ill create a Card.class, and inside of it i have fields like color, size for example, than ill create the shape with General Path than fill the color i want, now my problem is since the card haves 2 faces how would i apply these 2 faces in the class? How would you guys in a suggest me to develop this game? Im not looking for make my code, only a way to follow my track.

Ps. sorry for my english and happy in being a part of this forum.

best regarnds
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Do you have the card game working at the command line? You cannot put a GUI on it until you have the game working.
Please post the image with the “Img” button, since many people are reluctant to click links on websites like this.
 
Bartender
Posts: 5465
212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi mauro,

apart from the question whether your card game works or not, two
simple strategies are:

1) make sure you have two Paints for your cards, one for the 'face up'
and one for the 'face down'. If you have a draw-routine in your card class,
you could give it a parameter 'boolean faceUp'.

2) use one specific card that represents a card 'face down'. The game class
(or whatever class you have that controls the game) could then decide
to draw a card, or to draw the 'face down' card.

Greetz,
Piet
 
Campbell Ritchie
Marshal
Posts: 79239
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe images representing faceUp and faceDown should be returned from the Card objects.
 
reply
    Bookmark Topic Watch Topic
  • New Topic