Handmade Hero»Forums»Code
jeringa
19 posts
Day 69; Q&A - collision rules
Shouldn't the collision rules hash be off the entity struct? Rather than a global table?

Also: In the Q&A you mentioned that you don't like Function pointers for the dispatch table, but wouldn't it make it easier to process the consequences of a collision that way?
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Day 69; Q&A - collision rules
If the collision rules hash was off the entity struct, how would you look it up if you were checking collision for the _other_ entity in the pair?

Pairwise things usually do not want to "belong" to one entity or the other, but rather live at one level up, because it gives you more options.

As for function pointers, what would be the specific thing that would become easier as compared to a switch statement or series of ifs/checks/etc.?

- Casey