Skip to main content
GameDev.net gamedev.net
🔒 Locked

ufo design

Started by ms75214 Jul 23, 2012 at 1:10 AM 3 replies 1.1k views
Original Post
ms75214
ms75214
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)
Rybo5001
Rybo5001
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.
Burning Hand
Burning Hand
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.
Holy burning hand of wrath
piercing forever through the heart
Krohm
Krohm
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

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
Previously "Krohm"
ms75214
ms75214

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.


Yes. Like space invaders.
Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.