Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Extending and Over-Riding  (Read 761 times)
0 Members and 1 Guest are viewing this topic.
Offline happybirthday

JGO n00b
*

Posts: 25



« on: 2011-06-22 02:23:45 »

Hello everyone,

I am making a physics based puzzle game and have designed the levels using XML the structure of the Level Design is as follows ..

BaseObjectClass -> This class makes the objects for the game.

LevelClass -> This class extends the BaseObjectClass reads from the XML and makes the object by calling functions defined inside the BaseObjectClass

My problem is that .. If suppose sometimes I don't wanna use the Default Image that i have mentioned in the BaseObjectClass and want to use the Image whose location I have provided in the XML file how can i do that ?
(suppose I have an Orange Colored Square as the default square and I want to create 2 exactly same squares but just Red in color .. how can i do that)

Any advice would be appreciated ..
Thanks a lot Smiley
Have a nice day
Offline ra4king

JGO Kernel
*****

Posts: 3155
Medals: 196


I'm the King!


« Reply #1 on: 2011-06-22 02:33:55 »

You can add a setColor(Color) method to BaseObjectClass.

Offline happybirthday

JGO n00b
*

Posts: 25



« Reply #2 on: 2011-06-22 03:06:32 »

thanx but that was just an example ...


actually I want to use different images ...

Like a Brick Shaped Image when i dont mention anything in the XML
and a maybe Mettalic Shine Image when i mention something like 'meta' in the XML ..
Games published by our own members! Go get 'em!
Offline ra4king

JGO Kernel
*****

Posts: 3155
Medals: 196


I'm the King!


« Reply #3 on: 2011-06-22 03:16:19 »

Then the BaseObjectClass should have an Image variable and the code that parses the XML should be able to assign the correct image.

Offline happybirthday

JGO n00b
*

Posts: 25



« Reply #4 on: 2011-06-23 01:18:59 »

thanx a lot Smiley
I dont know why I was confused but you sure helped Cheesy
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.121 seconds with 20 queries.