A brand new game
for Windows, Linux, Mac, HTML5, 3DS Homebrew and more
30th March, 2018
Thankfully, yesterday's Image Buffer battle was much simpler than the previous Audio Buffer quirks.
A simple case of drawing onto a stored buffer, then drawing the buffer to the screen.
In this case, I'm drawing the floor, then plotting skidmarks over the floor so that they stay onscreen for the entire game.
It works, but not after a whole lot of maths to get things lined up correctly.
Part of the problem is that, to save on drawing time, the buffer is actually 4 buffers in a 2x2 grid, so there's obvious quirks with doing that.
I've also scaled up the buffers to 2x their size, so any and all draw-to-buffer maths has to be scaled down so that the drawn buffer plots end up back where they're supposed to be.
Add to that the fact that the buffer draws from the center, not the top left like I probably should've done, and things once again get a little more complex.
In all, it wasn't that bad, but it was certainly more complicated that I expected, going in.
I also had to add Alpha Transparency to the buffer's Plot command, meaning there's oodles of maths in there to figure out the correct colour to plot back onto the image.
So, after yesterday's work, I now have a "car" (exclamation point) "driving" (direct x/y movement via joystick) across the floor (rubbish leafy grass effect), leaving a "skidmark" (series of brown dots) behind it.
Today I need to draw a car, and get half-decent vehicle physics working.