Child Units
I might be making up the term but what I'm trying to do is create support type units for general units and wanted to ask if anyone has suggestions.
What I mean by child unit or support unit is I have a general game unit which would be able to hold 4 support units or child units. These general game units would only be able to hold a maximum of 4 children at a given time. These children interact with the game environment independently of the main unit actions. Although they can only travel a certain distance from the main unit. Once a child is killed the main unit can generate another child.
If you have ever played an airplane shooter you would be familiar with these types of units which would be upgrades like mini plans that fly on your sides.
One issue I'm coming up with is that the user will be able to dynamically generate a number of general units which will all have their separate support units. My approach has been to create a general unit class which would then handle all the child unit creation and logic. I created an array which is populated with these support units (I have a separate class for the support units). Where I'm stuck is on rendering the units to the screen as I am not able to quickly reference the units in the array (not sure why).
Before I invest anymore time trying to get this approach to work I thought I would ask if anyone has suggestions, tips or better ideas for this problem.
What I mean by child unit or support unit is I have a general game unit which would be able to hold 4 support units or child units. These general game units would only be able to hold a maximum of 4 children at a given time. These children interact with the game environment independently of the main unit actions. Although they can only travel a certain distance from the main unit. Once a child is killed the main unit can generate another child.
If you have ever played an airplane shooter you would be familiar with these types of units which would be upgrades like mini plans that fly on your sides.
One issue I'm coming up with is that the user will be able to dynamically generate a number of general units which will all have their separate support units. My approach has been to create a general unit class which would then handle all the child unit creation and logic. I created an array which is populated with these support units (I have a separate class for the support units). Where I'm stuck is on rendering the units to the screen as I am not able to quickly reference the units in the array (not sure why).
Before I invest anymore time trying to get this approach to work I thought I would ask if anyone has suggestions, tips or better ideas for this problem.
grazhoper Wrote:Where I'm stuck is on rendering the units to the screen as I am not able to quickly reference the units in the array (not sure why).
Sounds like you should focus on that. There shouldn't be any reason why you can't get wicked fast access to anything in an array.
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
cocos2d: memory question adding child to scenes | sefiroths | 8 | 13,171 |
Apr 19, 2011 08:06 AM Last Post: OneSadCookie |
|
how to call fathers setNeedsDisplay from child. | iluzone | 5 | 8,804 |
Dec 7, 2006 04:11 AM Last Post: iluzone |
|
Good Game Loop with Physics Units | blobbo | 6 | 7,089 |
Oct 14, 2005 02:59 AM Last Post: unknown |