Day 3: assembling ingredients, 1s and 0s


Today I focussed on making each ingredient "grabable" and "dropable". The idea is:
- you can grab something that in the "ingredient box"
- you can only grab one thing at a time
- you can only drop on a plate

Now the trick was to not allow the same ingredient twice on the plate. Since PICO-8 has flags, I've decided to go with a relatively clever approach, where each element has a different bit value that makes every possible combination totally unique.

Let's say:
- a sausage is 2
- a plate is 32
- mustard is 8

Now we have:
- sausage+plate = 34
- sausage+mustard = 10
- plate+mustard = 40
- all 3 = 42

Each combination being unique, I can then draw every sprite, one by one:


I can then assign a different flag value to every sprite, corresponding to the sum of the flags for every ingredient!

Now where this will be useful is when I'll start working with _recipes_. I'll just have to compare the flag of the sprite to the value of the recipe, and it'll be enough to decide whether it's the right meal or not :)

Get Kitchen fire

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.