I'm working on an engine for a shooting game where you control two dimension-travelling ships at the same time, where the negative space (or area of maneuverability) of one dimension is the positive space (or collision map) of the other. You're able to switch between ships to destroy or increase space, so the ships have to work together or else they get stuck in their positive space and the player is penalised for this. The engine's a tad scrappy at the moment.
WHAT I'M TRYING TO FIGURE OUT:
Moving objects and enemies are allocated to one dimension. If there is a section of black space, white enemies will move in formation through it. If that section of space is white, the enemies are for all intents and purposes invisible (but still existing), until the space is converted (where they become an active obstacle). The way the engine works at the moment is that there are two surface objects for each dimensional background, and the foremost black background is the one that's being edited by the player (to remove space or increase it).
At the moment I've figured out that enemy test objects can collide with the actual appearing segments of the foremost black background - if the area they're on is set to Alpha=255 (or basically invisible) then there is no collision detection for that space. What I want is for the enemy test object's sprite to be influenced by the shape of the visible background. E.g. if the test object overlaps a corner of visible background, then that corner-sized area of that test object is made invisible; if the test object is invisible but overlaps a negative-space background, then that background makes the overlapping area of that test object visible again.
example-1.png
I theorise that there are two different ways to go about this:
- When a test object overlaps with the black background (and the area of that background that the test object is overlapping is set to Alpha=0), then the engine takes a copy of the background, determines what is 'blank', and uses the rest of the image to determine what portion of the test object should be redrawn over with transparency. So as the black test object scrolls over the black background, it slowly disappears from view as the area of visible black background is drawn over the test object as 'Alpha=255'.
- When a test object overlaps with the black background as above, then the engine finds the colliding pixel on the test object and changes its transparency accordingly. So as the white test object scrolls over the white background, it slowly disappears from view as each pixel colliding is found by the engine and changed to 'Alpha=255'.
I've attached a copy of the .mfa with the post, containing three test frames of the engine: a single-screen frame with basic functionality; a clone of the same with modified BlackSurface graphics and two Item objects (group.Bonus) to demonstrate the above collision/transparency issue; and an advanced frame with camera scrolling and basic disappearing/reappearing objects. My main area of concern is the second frame.



Reply With Quote