TowerDefense

Introduce your project and write about your work.

Moderator: PPS-Leaders

Post Reply
erbj
Noxonian Pryllgnothor
Posts: 1
Joined: Thu Mar 05, 2015 12:22 pm

TowerDefense

Post by erbj » Thu Mar 26, 2015 2:33 pm

This project has been created before I started.

I worked with 2 other people at the project last semster (Fall Semester 2014).

So now Spring Semester 2015 I work on my own, refining it, fixing bugs and adding new features.

Upgrades until now:

- Towers inherit from turrets now.

- I set the model for the tower ad a cretain position and then place the turret (actual shooting thing) on the same place without a mesh (so it can move without the tower moving in all the directions)

User avatar
x3n
Baron Vladimir Harkonnen
Posts: 810
Joined: Mon Oct 30, 2006 5:40 pm
Contact:

Re: TowerDefense

Post by x3n » Sat Mar 28, 2015 12:19 pm

I like it that you use the turrets. Re-using existing code is always a good idea ;)

I don't know the code, but when I think about a tower, I think that it is responsible for two things:
  1. being placed somewhere, maybe being moved, having a cost, a level, etc
  2. shooting at enemies
These are two completely different concerns and often it makes sense to separate them in code. See http://en.wikipedia.org/wiki/Separation_of_concerns. This could mean that you use the existing turret for (b), but maybe you still need your own class to implement (a).

I think that this could also help to adress the issue with the tower's movement. You have a static tower (a) with a movable turret (b) mounted on top of it.

Of course you could implement both concerns in one class, but the design principle of 'separation of concerns' implies that it's often better if you use more than one class. This way it's easier to understand and modify the code. And maybe sometimes you want a tower which has a completely different implementation of (b), e.g. a land mine which explodes if an enemy steps on it, while the implementation of (a) is still the same. It you use SoC it's easier to do that because you only need to re-implement (b).
Fabian 'x3n' Landau, Orxonox developer

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests