Handmade Hero»Forums»Code
Iker Murga
43 posts
Bug in stopping point of Familiar
(I am still on day 68 so sorry if it has been mentioned on these last 2 days, however since the bug remains on day 70's code I am assumming it hasn't been spotted yet)

In GAME_UPDATE_AND_RENDER, in the switch case for the familiar(line 980), the familiar loops through the sim region entites to find the closest hero and calculate the distance. However, this distance is then multiplied by 0.75 (I believe it was to give the familiar priority over following the hero rather than another familiar when there where multiple familiars on screen). Incidentally, the if clause enclosing this statement is redundant since this code can only be reached when the entity type is of the hero kind (previously it could either be a hero OR a familiar).

This results on the minimum distance (ClosestHeroDSq to be modified from the 3 meters that are checked on line 1007 to a smaller distance, and is the reason why the familiar is stopping closer than it should.
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.
Bug in stopping point of Familiar
Good catch Iker... I will make a note of that!

Thanks,
- Caesy