Tag Info

Hot answers tagged

3

The answer to the question "Is it possible, or even feasible, to have graphics engine completely decoupled from game logic?" is "yes". I would say it is even "advisable". But in general, you'll find a lot of your game ends up tied to the engine you choose for other reasons, like input handling or use of their facebook integration or other cross-platform ...


3

It's OK to have component dependencies. And the more explicit the dependency the better. There's nothing worse than dependencies hidden behind useless layers of indirections. Your case doesn't look like a dependency hell to me. No circular dependency or unclear ownership of data: consider yourself lucky! Now I still believe that you need to reverse your ...


2

Vector mathematics! Assuming you're using Unity, you could use the inbuilt functions of Vector2: transform.position = Vector3.MoveTowards(transform.position, target, speed); Otherwise, here's how it's done - first, calculate the direction from point A to point B: public static float Length(float x, float y) { return Math.Sqrt(x * x + y * y); } ...


2

In my experiences there aren't too many ways around the fact that, you're right, all your different game entities and their components need to be aware of the state of the game and their own state. It's a mess unless you design with state machines in mind. The best way I've found to deal with it is to make sure that components are all doing small pieces of ...


2

CharacterController controller Has a radius and height that define its space occupation. (the green cage in the image). That cage (capsule) interact with othe colliders (i.e : the terrain). If the cage its too big respect the enemy shape, you see it fluctuate, because the cage bottom touches the ground.


1

Store the keys from the last frame and compare in the current frame. if(!old_keys[key] && keys[key]) { /* pressed since last frame */ } if(old_keys[key] && !keys[key]) { /* released since last frame */ } if(old_keys[key] && keys[key]) { /* held since last frame */ }


1

In simple terms a common design in SpriteKit games is scenes, layers, nodes and child nodes. You might make each part into a discrete class that encapsulates all of the parts, properties and methods. For example a Background class that has layered images, particles, various properties like the speed each layer should move and public methods to start and ...



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