We can see one of the shortcomings of the collision detection method in CV3 during the battle against Dracula's floating heads. The heads themselves function pretty normally. It's the drool that is bugged. Watching the RAM values, we can see when the drool splashes on the ground, it has a y-coordinate of #A0. Trevor, Sypha, and Alucard have a standing y-coordinate of #B0, but Grant has a y-coordinate of #B4. Thus, the drool sprite's origin is 16 pixels higher.
Collision detection in CV3 is basically
abs(PC.x - NPC.x) < (PC.width + NPC.width)/2
horizontally, and for the vertical check
abs(PC.y - NPC.y) < (PC.height + NPC.height)/2
Given PC.y is #B0, NPC.y is #A0 (when splashing), NPC.height is 16, Trevor et al height is 24, and Grant height is 20 (while standing), we end up with the following requirements:
Trevor Hit = abs(#B0 - #A0) < (16+24)/2 = 16 < 20 = true
Grant Hit = abs(#B4 - #A0) < (16+20)/2 = 20 < 18 = false
In other words, even if Grant stands in the exact same position as Trevor et al and there is drool at that position, Grant will not get hit!
There is a very small chance for Grant to get damaged by the drool splash on the ground. Just before the drool splashes, it performs one last collision check. At this time, there is a 25% chance the drool's y-coordinate will be #A3, depending on the y-coordinate the drool was spawned at. If we look back at the algorithm, when the drool is at #A0, it is 3 pixels away from hurting Grant. Thus, there is a 25% chance Grant will get hit by drool at the exact moment it hits the ground.
The drool gets snapped to #A0 when changing to the splash sprite, so Grant will never take damage from walking over a drool splash. Trevor et al, on the other hand, will. Grant's hitbox is technically 4 pixels below that of Trevor et al. In other words, Grant will actually take damage from drool if it's below him and he is in the air. Not only can jumping while standing in a drool splash hurt Grant, so can just simply being a few pixels above the drool as it's falling. Grant will seemingly take damage from nothing.
We could change Grant's height to alleviate this issue, but then that would actually remove any benefit he had elsewhere in the game. For example, a bone statue's fireball would be able to hit Grant now. Instead, the drool would need to be fixed. The sprite origin would need to be move down 16 pixels and the y-offset on impact would need to be adjusted to account for the change.
where i can download it?
ReplyDelete