Home Artists Posts Import Register

Content

We are releasing one Bach Invention portrait every day for 15 days, with Chris (Gruber_music) who remade the musics in Pico-8. (I can't prove it yet, but I'm fairly certain he used some form of black magic)

Hi everyone!

Today's portrait features a suspiciously colorful drink and while Bach wonders whether or not he should drink it, we're going to look at how it works!

Let's start by looking at the sprite-sheet!

As you can see, the 'liquid' part of the sprite is all green. After drawing that sprite on the screen, all we have to do is find those green pixels and replace them with the rainbow color defined by 'flr((x*0.5+y)/8+t*4)%7+8'.

To find those pixels, we'll use 'pget(x,y)' on every pixel of the rectangle occupied by those green pixels like so:

<code>
for y=84,108 do
for x=91,108 do
 if pget(x,y)==11 then
  local c=flr((x*0.5+y)/8+t*4)%7+8
  pset(x,y,c)
 end
end
end
</code>

To get those coordinate boundaries, I simply made a guess, ran the program, tweaked the values, ran again, tweaked again, until I have exactly the right coordinates. Alternatively you could have calculated them from the position where you drew the sprite, it would have been cleaner but this took me less than 2 minutes so why would I make it any more complicated?

But if you look closely at the sprite-sheet, you might see some dark-green pixels at the bottom of the drink. We'll scan for those too and when we find them, we'll use the darker shade of the rainbow color, using this array: drk={[0]=0,0,1,1,2,1,13,6,2,4,9,3,1,1,2,4}

That's our rainbow drink figured out. Let's make it fizzy!

I won't have to write much on this since I'm using something very similar to the dust/snow effect we saw last week, only this time the particles only go up, they're always just one pixel, you draw them only if the underlying pixel is green, and the particle can appear either white or dark-green! This must happen before the rainbow treatment, so that the rainbow treatment picks up the dark-green particles.

And that's it, our fizzy magical cocktail is done! Do ask any questions you might have!

As usual, the downloads for this portrait are available to my 5$+ supporters over there!

Thank you for reading!

Take care!

TRASEVOL_DOG

Files

Invention No. 8 in F Major, BWV 779 (Pico-8 Edition)

Invention No. 8 in F Major, BWV 779 composed by J.S. Bach (1685-1750). Music arrangement by Gruber (@gruber_music) Artwork/Animation/Code by Trasevol_Dog (@TRASEVOL_DOG) Support us on Patreon! https://www.patreon.com/Gruber99 https://www.patreon.com/trasevol_dog Arranged and animated in Pico-8. Pico-8 is a fantasy console for making, sharing and playing tiny games and other computer programs. https://www.lexaloffle.com/pico-8.php

Comments

No comments found for this post.