I am struggling with a OOP concept of father-child relations in BliztMax. All of this must be done in a OOP way.
For the purpose of portability the code must be strict adhering to C#/Java conventions. The only way i think thats possible is to have a father-child relation, with one object being the father of all other objects (using a TList).
Anyone who has done a bit of M$ Excel programming will know what i talk about. In Excel you instantiae an Excel Appinstance, then add worksheeets to it, and worksheets have rows, cells etc. So in a way one can trace from one worksheet to another by object model, for example to retrieve data from one sheet to another or to compare values etc etc.
Basically what i want to do (for a game) is:
* Instantiate a Father object which has as only a TList property.
* Add all other objects to Father (ships, missiles, starfield).
My problem is: i need some help on doing it.
Here is a practical example:
1. Instantiate Father object.
2. Instantiate a TMain object.
3. Add the object to Father.
4. Do a TMain.GetTheShowOnTheRoad() method.
The idea is then that a alien (object) can have a bullet (object), which is all ofcourse to be traced back right to Father. Also, alien could add powerup, and powerup can add defenceshield object. Ultimitley defenceshield belongs to alien. In this OOP way i could remove defenceshield then add it to player ship. You get what i mean?
Does any1 have a small example for me?? I'd really appreciate your help!
Is this way of doing working with father-child too complicated? I wanna make a basic framework which will bebefit in the long run. Whats your opinion?
here is an example of what i try to do:
Is the above coorect to implement the M$ Excel-objectmodel idea? TIA!
For the purpose of portability the code must be strict adhering to C#/Java conventions. The only way i think thats possible is to have a father-child relation, with one object being the father of all other objects (using a TList).
Anyone who has done a bit of M$ Excel programming will know what i talk about. In Excel you instantiae an Excel Appinstance, then add worksheeets to it, and worksheets have rows, cells etc. So in a way one can trace from one worksheet to another by object model, for example to retrieve data from one sheet to another or to compare values etc etc.
Basically what i want to do (for a game) is:
* Instantiate a Father object which has as only a TList property.
* Add all other objects to Father (ships, missiles, starfield).
My problem is: i need some help on doing it.
Here is a practical example:
1. Instantiate Father object.
2. Instantiate a TMain object.
3. Add the object to Father.
4. Do a TMain.GetTheShowOnTheRoad() method.
The idea is then that a alien (object) can have a bullet (object), which is all ofcourse to be traced back right to Father. Also, alien could add powerup, and powerup can add defenceshield object. Ultimitley defenceshield belongs to alien. In this OOP way i could remove defenceshield then add it to player ship. You get what i mean?
Does any1 have a small example for me?? I'd really appreciate your help!
Is this way of doing working with father-child too complicated? I wanna make a basic framework which will bebefit in the long run. Whats your opinion?
here is an example of what i try to do:
Strict Local objStart:TMain = New TMain; objStart.Main(); '#Region AppInstance moeder van alle Objecten Type TAppInstance Global AppInstance:TList; End Type '#EndRegion '#Region TMain Type TMain Extends TAppInstance Global objGameObjectsList:TList; Global ScreenWidth:Int; Global ScreenHeight:Int; Method Main() ShowMouse(); objGameObjectsList = new TList(); Local objMain:TMain = New TMain; Local intSterretjeTeller:Int; Local objAlien1:TAlien = new TAlien; objGameObjectsList.AddLast(objAlien1) End Method End Type
Is the above coorect to implement the M$ Excel-objectmodel idea? TIA!