Tag Info

Hot answers tagged

3

Don't shove all the events into one type. You are using C++, a language that supports Abstract Data Types. Use them! Inheritance/Interfaces struct Event { TYPE type; virtual void Handle() = 0; }; struct DamageEvent : Event { float damage; int target; void Handle() final { FindTarget(target).TakeDamage(damage); } }; void ...


2

Since m_VAO is valid in constructor but not in draw(), it seems that the destructor was called before draw(), perhaps by copying an instance of the Polygon class. P.S. Errors like these could be prevented by following the Rule of three.


1

This is a classic collision detection problem. Thinking about it in pixels isn't the right way of going about it though. What you need to do is have a geometric representation of your player and the boundaries of your tile map. This might be as simple as just having a bounding box on your player and on each tile. When the player's bounding box intersects ...


1

As someone who has implemented an entire Math library including Quaternions let me say that just following a tutorial will not get you anywhere with this. To iron out bugs like this you really need to understand how Quaternions work, what they are and how to use them. It's probably some of the most complicated math in Game development and I don't recommend ...


1

https://www.youtube.com/watch?v=DOpqkaX9844 This is a great tutorial on tilemap collision, but you can also use Box2d. That is what I ended up doing because tilemap based collision only works if your character moves in increments of 1 tile at a time. If he can move fractions of a tile it doesn't really work.


1

Use an influence map for target searching. Have a grid and on each node, reserve a spot in a collection of units for each team. For each unit, generate a collection of coordinates within range and offset these coordinates as the unit moves. When a unit searches for a new target, enumerate over its coordinates within range. If another unit is on one of ...


1

You need to check two things: 1.Texture and Shader ETC1 doesn't support alpha. You'd have to use a separate texture read (which you seem to be doing on texture2D(CC_Texture1, v_texCoord2). You can use tools to extract alpha channel from a RGBA texture and use a single texCoord for both samplers. Your code could be something like this: vec3 tex = ...


1

Another way you could go about it by using a "generic" map for your parameters: int HashStringToInt(const std::string& aStringToHash) { // Hash your string here } union Value { int _int; double _double; bool _bool; }; struc Event { int _id; std::map<int, Value> _parameters; }; void boom() { static const int EVENT_EXPLOSION = ...


1

You're right, it can be done in two ways: -Moving the player -Moving the world This seems like a 50-50 deal. It doesn't matter how you do it, right? I don't agree. I would ALWAYS suggest moving the player. Because if you choose to move the world now, and a few months further on in development, when you have enemies, npc's, and other entities on screen, ...



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