Sign in to follow this  
ms75214

ufo design

Recommended Posts

Let me know if this is good design for UFO game.
Superclass is UFO.
Subclass is UFO_Up_and_Down. (moves up and down)
Subclass is UFO_Side_to_Side. (moves side to side)
Subclass is Kamikaze_UFO. (goes straight for the player)
Subclass is Slider_UFO. (moves across screen from right to left or vice versa)
Subclass is Sine_Slider_UFO. (moves across screen from right to left but with sine bobbing motion)
Subclass is Hammer_UFO. (slides in from right or left to player's x coordinate… then drops!)
So, there will be a virtual method called move:
virtual void move(void)

Share this post


Link to post
Share on other sites
You haven't given me any information to determine if this is "good" or not, remember that something being good is relative.

If I'm correct in assuming this is like Space Invaders, I'd say yes it is good.

Share this post


Link to post
Share on other sites
I'm not to sure here if you are looking for programming assistance, or design assistance, but either way you haven't really given enough information to know what your question is really asking.

Share this post


Link to post
Share on other sites
This is a programming related question.
Bad design. You can do everything with a single class and a supporter class controlling it. This class could be something like
[CODE]
class UFOTargetProvider {
public:
virtual single3 GetTarget() = 0;
};
class UFOPatrollerTarget : public UFOTargetProvider {
double time;
const single3 from, to;
public:
UFOPatrollerTarget(single3 p0, single3 p1) : from(p0), to(p1) { }
void Tick(double inc) { time += inc; }
single3 GetTarget() {
if(int(time / period) % 1) return to;
return from;
}
};
UFO(UFOPatrollerTarget(SCREEN_LEFT, SCREEN_RIGHT); // equivalent to UFO_Side_to_Side (terrible naming by the way)
UFO(UFOPatrollerTarget(SCREEN_UP, SCREEN_DOWN); // equivalent to UFO_Up_and_Down
[/CODE]

Share this post


Link to post
Share on other sites
[quote name='Rybo5001' timestamp='1343017959' post='4962134']
You haven't given me any information to determine if this is "good" or not, remember that something being good is relative.

If I'm correct in assuming this is like Space Invaders, I'd say yes it is good.
[/quote]

Yes. Like space invaders.
Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this