A brand new game
for Windows, HTML5, iPhone, Android TV and more,
every week,
unless exhausted!
Blog
Buffer!!!
  30th March, 2018
Arrrgh!! Buffers!!

-=-=-

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.
Hmm..

Views 10, Upvotes 2, 30th March, 2018
Daily Blog
Site credits : Jayenkai put all his heart and soul into everything you can see on this site.
(c) Jayenkai 2017 and onwards.
Blog - Buffer!!! - AGameAWeek