February 19th, 2016Getting Physical

And with that brilliant pun another week has passed and we’re back again, for the 7th installment and 4th time since I proclaimed I’d stop writing about this boring nonsense, striking a perfect balance in keeping me motivated without making it feel like an obligation. Mh, exposition.

Anyway, what’s new? Well, for one, CORE manages the drawing of sprites and text elements entirely on its own now, leaving you free to tinker with the properties you need. It also supports collision between rotated sprites now, which is very helpful for this little bit of fun:

Yes! Physics! Now all I need to do is figure out how physics actually work!

Still, the hard part this week has been getting collision between rotated rectangles to work. I strongly doubt the way I did it is the most efficient one, but the basic idea is this: I first check if they are within range of each other by looking at their AABBs. If they are, I rotate each corner point of the second rectangle around the origin of the first, so that their relative position remains the same, but I can now check if the corner is contained within a normal unrotated rectangle. If any one of them is, the rectangles intersect. If they don’t, I do the same in reverse to see if any of the other rectangle’s corner points are contained within the second. This is the part that could and probably should be optimized. I did come across some much better-looking approaches, but they were quite confusing as well, so this’ll have to wait for another time.

Even so, it does come along nicely. Soon I’ll have to try making an actual game with it to see what sort of functionality I’d still need or would like to have. I’d like to think that there couldn’t be anything too major missing anymore, but then I just remembered that perhaps audio capabilities might be a good thing to have, so who knows what other obvious stuff I’ve overlooked. Like a camera for example. Or fullscreen.


Crabman out.