• Post Reply Bookmark Topic Watch Topic
  • New Topic

Two windows are being made of my game  RSS feed

 
Michael Wal
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a game which is very simple: it is two images, and one needs to reach the other. Once it does, it resets. I have a class which holds the two images, and another which holds the game. My images class extends my game class. The problem I am having is that when I run the program, not one, but two frames appear. One is the perfect game, working perfectly, and the other is the game without images. I want the one that is the game without images to simply stop appearing. I believe it is appearing because my class that displays the image is extending the game class, but I can't not extend it because if I do I get a whole lot of bugs and errors. Does anyone know how I can fix this error? Thanks for taking your time to read and help!

Image class:



Game Class:



Thank you!!
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your DisplayImage class extends the Game class why?
Remember, inheritance should conform to the "is a kind of" rule. So does the following make sense: DisplayImage is a kind of GameM?

The reason you get two frames is GameM creates and displays a frame and because DisplayImage extends GameM it does too.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!