User Tag List

Results 1 to 4 of 4

Thread: Surface Object - Paint Over An Object?

  1. #1
    No Products Registered

    Join Date
    Dec 2012
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Surface Object - Paint Over An Object?

    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:

    1. 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'.
    2. 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.
    Attached files Attached files

  2. #2
    No Products Registered

    Join Date
    Dec 2012
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Code:
    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.
    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.

  3. #3
    No Products Registered

    Join Date
    Dec 2012
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    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.

    Code:
    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.

  4. #4
    No Products Registered

    Join Date
    Dec 2012
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

Similar Threads

  1. Help with: Surface Object ?
    By Alon Dan in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 3rd January 2014, 10:42 AM
  2. Surface object "paint images"
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 15th February 2013, 09:20 AM
  3. Surface object
    By Looki in forum Released Extensions
    Replies: 4
    Last Post: 18th October 2010, 01:38 AM
  4. surface object
    By imothep85 in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 17th September 2010, 01:05 AM
  5. [Request] Advanced paint object
    By Jacob in forum Extension Development
    Replies: 6
    Last Post: 23rd October 2008, 12:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •