User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Edge Detection example

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Edge Detection example

    This is a feature I needed in my game, so I decided to make an example of it. This uses a surface object as a collision mask in order to gather data about the surroundings of each tile, and changes the animation frame of the tile based on those around it. With this engine, you can just place tiles into your game and it will automatically change to the correct tile so you can have nice looking borders for your games

    The engine itself uses bitmasks, which is a fairly simple idea once you understand it. It looks complicated, but it's rather basic. I add the red coefficient of the grid cell to the right of each tile, divided by 255, to give 0 if there is no tile and 1 if there is. Then, I do the same for the cell to the upper right, but I add 2 instead of 1. For the cell directly above, I add 4. As it goes around the tile, I add a doubling amount each time, moving to 8, 16, 32, 64, and eventually 128. This means I can set the animation frame to this value and will always have the proper position data. For frame 50, which is 32+16+2, I can tell that the bottom left, left, and top right cells adjacent to the cell I am looking at have obstacles in them. So frame 50 would leave those sides of the cell open, whilst closing the other ones. Take a look at the example.swf file to see what this is actually accomplishing

    If anyone would like a better explanation, just ask and I'll try to be more in-depth. Have fun!


    Attachments
    Example.swf [size:8pt](666 downloads, build 252)[/size]
    Source.mfa [size:8pt](1337 downloads, build 252)[/size]

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    Ls2's Avatar
    Join Date
    Jun 2011
    Location
    Maceiˇ - Brazil
    Posts
    945
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    Great example, Jacob
    Very simple too Oo'

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    Thanks!

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Tisnart's Avatar
    Join Date
    Feb 2008
    Location
    On, Canada
    Posts
    1,124
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    Very Nice,
    Thanx for sharing Jacob

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    I have updated the example SWF with a new file which shows how it looks with actual game graphics Same link, http://games.jacobpariseau.com/edgedetection.html

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    To make this actually usable for other people (and myself) I have created a Tile Generator. Using the surface object, you merely have to draw the edges of the tile and it will build you the result tiles and save all 256 of them to the directory the app is run from. Save before running, so it doesn't just put them in a temp directory.

    Attachments
    TileGenerator.mfa [size:8pt](i downloads, build 253)[/size]

  7. #7
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,810
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    Thanks Jacob.

    Build 253?

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  8. #8
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    Yep, and the square root of negative one downloads, too!

  9. #9
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,810
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    What?

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  10. #10
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Stephen's Avatar
    Join Date
    Aug 2008
    Location
    Montana
    Posts
    4,515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Edge Detection example

    Very clever, Jacob.
    _____________________________________________
    Nivram's Examples -Need extensions? Send me a PM.-


Page 1 of 2 1 2 LastLast

Similar Threads

  1. Edge Enemy
    By vSv in forum Multimedia Fusion 2 - Technical Support
    Replies: 31
    Last Post: 8th December 2018, 09:30 PM
  2. Help with image edge detection
    By phanchingchong in forum Fusion 2.5
    Replies: 5
    Last Post: 1st January 2014, 02:45 PM
  3. 'Manual box colission' VS 'Built in colission detection ( fine detection checked )'
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th February 2012, 09:32 PM
  4. Window's Edge
    By FlinkGigitty in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 17th April 2011, 10:57 AM
  5. Edge of Awe
    By twister in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 7th May 2010, 07:08 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
  •