Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Sure thing! Here's how it works:

  • The environment is stored as a 2D array of pixel object, which each stores its current color (black pixels are just null, with no pixel object).
  • When a blood drop hits a wall or passes over a pixel object in the background, the addColor(Color c) function is called on the pixel at that (x, y) coordinate.
  • If the pixel's current color is not c, then its color gets changed to c, thus coloring it in.
  • If the pixel's current color is already c, then addColor(Color c) gets called on all adjacent pixels, thus spreading the color.
  • (Make sure to use a set of pixels to keep track of the ones you've already visited so you don't visit the same pixels multiple times).
  • (You may also want to add a range to the maximum spread distance, or prevent color from spreading upwards depending on your needs).

That's the basic version of how it works. It gets more complicated if you want to add in color mixing like I have in Blood Pressure, but I'll leave that up to you to figure out. I should also mention that this system works well in Blood Pressure because of the simple, monochrome artstyle with a lot of negative space. IDK how well it would work with other artstyles, but feel free to experiment.

(+1)

Thanks for your quick respond. I think I now know how you've done it thanks again. : )