Mega-Cluster Ejecta Upgrade
This was a minor update, but one that I’ve been puzzling over for a while: I wanted the ejecta from the MegaCluster boss to appear at the opposite edge of the asteroid from where it had taken damage, ideally with a line to describe the path of the shockwave (the current implementation had the ejecta spawn at the centre of the asteroid and drift out with a necessary and confusing delay from the time of impact). Finding the big sprite’s edge was the problem, as there wasn’t an in-built function (that I could find) that draws a indicates when an extending line is no longer colliding with something.
In the end, my solution was to extend an imaginary line from the point of impact in the trajectory of the bullet (+- a bit of random angle for flavour) until safely outside the sprite, create a dummy sprite there, and then measure the distance from the dummy back along that trajectory until a point_collision
occurred with the boss (in precise-mode, rather than bounding-box). Subtracting the length of the second line from the first, over-long line, produced the exact distance to the outer surface. Hoozah! Gamemaker comes with distance_to_point
and distance_to_object
functions that claim to measure to/from an outer-edge, but these all seem to use the object’s bounding box rather than its collision mask, so early attempts to use those functions resulted in weird gaps and over-long lines.
I released 22.1011 with this implemented and tested, but I’d like to add a bit, having the aggressive “ejecta-shots” also appear at the edge, possibly spray a bit, and not survive the void. Seems a bit kinder.