Gals Panic, is a Qix type game. You may search for Qix to get more information on how things work.
The general concept here is, having two images. One is the picture that you want to be revealed. The 2nd one is the actual gamefield where the game is checked against. These two are combined to produce the end result. So suppose the filled game area is white and the backdrop is black, a simple multiplication can make those white areas show the revealed picture.
There are two ways of realizing the gameplay field. The first one, is the way Gals Panic actually works: checking against pixels. The 2nd one is create a polygon structure. Both have advantages and drawbacks.
The Pixel way
Think of the game Snake. The line drawn by a player is like the snake. Each movement a check runs: does the player hit a pixel colored as its own line? Yes -prevent movement. Does the player hit a pixel colored as the revealed area (white)? yes- do a floodfill in the closed off area. The Closed of area is determined by the position of the "big bad" in the game. So if you do a quick floodfill on say- left of the drawn line; check if the "big bad" is in the filled area. If he is, then you need to flood fill the other side of the line.
- Like in Gals Panic, "big bad" can destroy revealed areas. This results in arbitrary shaped holes or isolated revealed areas. For the pixel method; this is easy.
- Percentage filled is similar to counting the revealed pixels versus the obscured ones.
- Speed. Since you work on a per pixel basis, flood fills become more expensive as the resolution increases. Gals Panic is an arcade game during the 224x256 screen resolution area.
- Gameplay speed has a direct relation to the number of pixels checked each frame. You can do speedbonusses, but those are a bit tougher to construct.
- Enemies etc. need a pixel collision type to move around etc.
The Polygon way
This method is based on adding polygons to the existing start polygon. Basically the line starts on a edge on the source polygon. When the line drawn ends intersects the start polygon, the polygon is expanded.
So determine where the start and endpoints are, then do a check if the "big bad" (via a point-in-polygon check) is inside the closed off area, then do a left or rightsided add of the line and the polygon has become bigger.
The polygons are then filled using a ear-clipping algorithm.
- Speed, this method is really fast, it also scales well (doesn't care the resolution of the source material for speed).
- There may be libraries to do polygon adding and ear-clipping algorithms for you.
- Enemies and other gameplay can do simple line intersection and point-in-polygon checks against the gameworld.
- The big bad "Eating" from the outside of the play area in the polygon is possible, but it makes the checks way more complex.
- Splitting the area up (due to the big bad doing something) makes this approach also more complex because you end up with multiple "source" polygons. It can be done but consider this from the start.
Inside out or Outside in
Gals Panic is a inside out style Qix clone. It starts with a revealed block inside the image and the gameplay extends to the edges.
Qix, Volfied, Styx use an outside in approach; the player starts on the outer edge of the playfield and fils the area inwards.
This has an important effect on your game if you plan to use the polygon approach. If you go outside in the polygon represents the area that is obscured (thus at start, the entire polygon covers the game area). This means you make the polygon smaller as the game proceeds. The reason is, the player can move along the edge of the polygon, thus at start this is the entire edge of the play area.
For inside out the polygon represents the revealed area, and is expanded as the gameplay proceeds.