Tag Info

Hot answers tagged

3

This may not be a good solution to your specific needs but I'm gonna tell you how I handled a similar problem. I developed a c++ object oriented game and wanted to encapsulate DirectX and COM in general inside my own classes, because I didn't wanted to use COM as base for the whole game. The COM parts of my game (at the moment direct3d, direct2d, ...


3

The idea is to have spell objects hold some reference to the in-code action you want that spell to do. Python's first-class functions make this quite nice (I'll assume Python 2.7.x): class Spell: def __init__(self, name, description, activationFunction): self.name = name self.description = description self.activationFunction = ...


1

You should think of how to generalize this system so that any key can perform any action. Not only can the player customize their keys, but you might also want to enable different key behaviors between different menus. You should be switching out the different keyboard mapping states when you switch scenes/to a new menu/etc. So when you enter a menu, the ...


1

Your mapping strategy sounds like it'll work great. The problem you really need to solve is having pretty display names for your enum values. See this question and answer on SO. Essentially, you can switch from a enum or you can use C# properties to save and display additional information about each enum value. Using either option, your dictionary is ...


1

The code should serve the software engineer. Not the other way around. The code should be written in the most intuitive and simple way it can be written (but not simpler). Do not take advice unless you understand who it's intended for and what it's intended to resolve. You are wearing a very uncomfortable pair of shoes because someone said so but do you ...


1

Try not to take the stuff you read in books too literally and apply concepts only where you think they really fit rather than just because you are trying to follow some pattern. In my case I design my entities to have properties based on what makes logical sense. I would not loop through every object in this manner because doing so per frame will get very ...


1

You want to use separation of concern which means it would be the scene managers responsibility to reset the scene. It already loaded the scene and created the game objects that fill the scene, you can/should reuse the code you wrote for that already. Simply keep track of which object matches up with the loaded data, if you don't have an object already ...



Only top voted, non community-wiki answers of a minimum length are eligible