This prototype is getting pretty math- and logic-intensive! But that’s good, because I like the challenge. Currently, I can fire shots at enemy blocks, which adds cracks to them. I already had the basics done, but I ran into trouble when cracks intersected each other. What I usually do, when I can’t figure it out after a while, is writing things down in a logical, illustrated way, and then reworking the code according to my new ‘flow scheme’.
So, with the new code, when a shot hits a block, the intersection point is calculated and it’s used as the starting point for the crack line. This crack line is used for collision checks, and for every collision, the given edge is split up into two edges, and for every two collisions, an edge between the intersection points is created. When another border edge is encountered, the whole process is aborted: you don’t want cracks outside the block itself!
There’s still a few bugs to iron out here, but once I’ve solved those I can work on the next stage: actually breaking up the blocks into smaller blocks.
And after that, it’s mostly adding some new weapon and enemy types, and then it’s playtesting time. :)