Steven M Posted December 17, 2012 Report Share Posted December 17, 2012 So I think I have a half-fix for this situation. I need someone to look at this and tell me what I'm doing wrong and how to fix it because it's making me tear my hair out. The situation: there is a layer with a black background surface object, a white background surface object, a black test object that moves horizontally on the screen, and a white test object with the same behavior. What I want is for the black test object to appear above the white background but to smoothly disappear behind the black background, vice versa for the white test object. The picture above is a little deceiving - the backgrounds in that example are flat, whereas the surface objects in my game are dynamic and change according to the player expanding one surface while erasing the other. So here's the 'code' I have running at the moment. Every 00"00 - BlackSurface move in front of WhiteSurface BlackItem is overlapping WhiteSurface AND BlackItem is overlapping BlackSurface - BlackItem move behind BlackSurface - WhiteSurface move behind BlackItem BlackItem is overlapping WhiteSurface AND BlackItem is NOT overlapping BlackSurface - BlackItem move in front of WhiteSurface Every 00"00 - BlackSurface move behind WhiteSurface WhiteItem is overlapping BlackSurface AND WhiteItem is overlapping WhiteSurface - WhiteItem move behind WhiteSurface - BlackSurface move behind WhiteItem WhiteItem is overlapping BlackSurface AND WhiteItem is NOT overlapping WhiteSurface - WhiteItem move in front of BlackSurface RESULT: the WhiteItem smoothly disappears behind the WhiteSurface and stays above the BlackSurface, but the BlackItem is overlayed above all other objects and refuses to change order (e.g. move behind a background when called for). RESULT #2: the events in MMF2 read from top to bottom. Switching the second series of events ("Every 00"00 - BlackSurface move behind WhiteSurface etc etc") from second to first on the list, results in the WhiteItem disappearing completely and the BlackItem sporadically appearing and disappearing. Link to comment Share on other sites More sharing options...
Steven M Posted December 18, 2012 Author Report Share Posted December 18, 2012 Every 00"00 - [Layer Object] Swap BlackSurface and WhiteSurface WhiteItem is overlapping WhiteSurface - WhiteItem move behind WhiteSurface - BlackSurface move behind WhiteItem Every 00"00 - [Layer Object] Swap BlackSurface and WhiteSurface BlackItem is overlapping BlackSurface - BlackItem move behind BlackSurface - WhiteSurface move behind BlackItem RESULT: Both Item objects are overlayed on the WhiteSurface, the furthest back in the order of objects, and they slide under the BlackSurface. Reversing the events list just changes the Surface order. Every 00"00 - BlackSurface move behind WhiteSurface WhiteItem is overlapping WhiteSurface - WhiteItem move behind WhiteSurface - BlackSurface move behind WhiteItem Every 00"00 - WhiteSurface move behind BlackSurface BlackItem is overlapping BlackSurface - BlackItem move behind BlackSurface - WhiteSurface move behind BlackItem RESULT: BlackItem overlayed on WhiteSurface, slides under BlackSurface. WhiteItem overlayed across all objects. Reversing the events list just changes the Surface order. Link to comment Share on other sites More sharing options...
Steven M Posted December 21, 2012 Author Report Share Posted December 21, 2012 Is there a way to test the position of an object by pixel? Theoretically if you could call a routine where the pixel of a test object is overlapping the background object, then you could use Transparency>Alpha channel>Set pixel and change that pixel to transparent or opaque. There doesn't seem to be a way to do that though. Even when the background is broken up into chunks because of the spots of Alpha=0 everywhere, it will only call a collision when the test object is overlapping an opaque part of that background - but you can't seem to glean any information from that to put into 'Set pixel'. Setting the test and background objects in order doesn't help either. It seems that there's always one object in front of everything else, rather than cycling the objects so that they're appropriately over/under other each other. The closest I got was a fastloop that sent each object to the back when their alterable value was called by the fastloop's ID, but that just resulted in flickering sprites. Link to comment Share on other sites More sharing options...
Recommended Posts