Suggest the way to design several classes
- by Oleg Tarasenko
Hi,
I'm building simple application on as3. Kind of starship game. What I want to do is to create several different star ships. Each one should have different images (different look), different sets of animation (e.g. when it's flying, burning, damaged), different kind of weapon and also different controllers (e.g. one can be managed by user, another one by computer, and I want to be able to reuse same ships for AI controller as well as for users controls).
Each ship is created in the following way:
Create entity
Add spatial
Add renderers
Add other components....
......
n. init the ship
So what I am trying to do:
1) Create StarShip superclass, to store HP (as every ship has it), store spatial (same reason)
2) Create inherited class for any other ship... (It will contain renderer - (responsible for display part), weapon, set of animations), etc
What do you think about such way of composition? Maybe it's better to place everything in super class, and then just create instances using long, long, long constructors like:
StarShip(hp:HP, animations:DICT, weapon:Weapon, ....)
Need advice