Loop Invader

A hidden-object game with moving pieces

Click Here to play the HTML5 version

🐛 BUG ALERT!!! 🐛

Do not let your code blocks touch each other! Always leave an empty space between them, otherwise the balls might glitch through and violate the constraints! The screenshot above shows an if(1) block touching a while(2) block (the blue one). Don't do that, because it can sometimes break and cause for example the 2 balls to escape the while(2) block, which is game-breaking and will confuse you! (I might update the game some day to fix this)


Loop Invader is my submission for the Ludum Dare #47 competition. The theme for the competition was "stuck in a loop".

The goal of the game is to find and destroy the "invaders", which are bad actors that hide among and infect your good data. It's basically a hidden-object game with moving pieces, similar to Hidden In Plain Sight, but as a single-player experience.

When an invader ball bumps into a data ball, it will cause that data ball's number to increase by 1 exactly 1 second later. By contrast, an invader's number will never change, even if it bumps into another invader. An infected data ball's number will decrease by 1 immediately when it bumps into another (non-invader) data ball, and it will never fall below its original value. So to find an invader, you need to keep an eye on which balls change on collision and which don't. This is nearly impossible due to the large number of balls in the game, so you need to use the code block tools at your disposal in order to win.

The player is able to create code blocks using their mouse, and can type in either a while loop or an if statement. The while loop is used to trap balls that fit the condition, and the if statement acts like a wall, which reflects balls that fit the condition and allows others to pass through. By combining these tools with knowledge of how the invaders work, the player can build creative solutions to track down and destroy the invaders.

I wanted to give the player room to be creative with their solutions, so the game allows you to type any loop condition you want. For example, a while(<=2) loop will trap balls with a value less than or equal to 2. Unfortunately, the game engine I was using didn't have any good text input support, so the solution maps key codes to ASCII values which really only works for standard QWERTY US keyboard layouts. If you have a different keyboard layout, you'll have issues. The competition's 48 hour limit forced me to compromise (at least it works on some keyboards!). This bug, and the code block bug mentioned above are the two main things I'd fix if I ever decide to release a post-compo update.