Tag Info

New answers tagged

0

You might have misunderstood me a little bit. Not all objects HAVE to use factories. Perhaps only your tower and enemy objects. Maybe your Attack object as well as a Projectile. You'll need to tinker to see what fits the pattern. Some people would create a generic Entity/GameObject class though. You could do some research on Entity Component Systems to ...


1

I would avoid the general idea of a tower type. Let tower contain a set of properties that matter. An Attack object (that has its own range, RoF, damage, sound effects, onHit() effect for DoTs, etc.), a model, health, location... Then build factory classes that are asked to build a "type" of tower by figuring out how to initialize a tower to be a "cannon" ...


2

Instead of having a TowerType enum and a lot of if/else/case constructs in your code which handle differences between types, you could make your types of towers separate classes which inherit from an abstract Tower base class. These classes would set their properties in their constructors. Using sub-classes would also allow you to have a different ...


1

Here is how i think it could be done class Class1 { public enum TowerType { A, B, C }; static private Dictionary<TowerType, Tower> towerTypesInfo; static void init() { towerTypesInfo= new Dictionary<TowerType, Tower>(100);//100 tower types towerTypesInfo.Add(TowerType.A, new Tower(20, 40, 50)); ...


0

I would try using an N-ary tree structure. The bubbles stack up in a skewed formation. If you take a bubble and surround it with other bubble, you will only get 6 possible connections: top left, top right, left, right, bottom left, and bottom right. Contrast this with a 2d grid and you get 8 possible connections: top left, top center, top right, left, right, ...


0

Submitting my earlier comment as an answer: So you are doing rasterization manually, without the use of a graphics library. If that's the case, you can emulate the depth buffer yourself. In addition to the color buffer, also store a z value in a separate image. Only write to the color buffer if the incoming z-value is less than or equal to the current ...


1

There's a few variables that aren't mentioned like how big you expect it to be, what platform the games are going to go on, etc so as usual there's a lot of "it depends" on any answer. One option is to serialize the data out to JSON. If you store some sort of checksum against the data you'll immediately know if the data has been changed. You can also ...


2

Depending on your needs, you could just serialize a Dictionary to a binary file. I can post some code after I get home, but this link explains the serialization features of C#: http://tech.pro/tutorial/618/csharp-tutorial-serialize-objects-to-a-file This is only secure-ish (a binary file is harder to hack than an excel spreadsheet) but that's all you ...


0

Not everything can be represented as a tree... You're conflating "adjacency" with "hierarchy". Both may be useful concepts, depending what you're doing with your world. (Also, just to mention, there's no "right way" to do it, it just depends on your needs.) Hierarchy in your tree is probably useful for moving things around. For example, parenting the pen ...


2

I would say think about what implication your organization have. E.g. the stow: If it where a top down game you would put the stow under the floor since if you go into the house you would like to make the ceiling invisible by making that node deactivated. If you would have put the stow under ceiling the stow would be goon to and that is not what you want. ...



Top 50 recent answers are included