User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24

Thread: Flipping Image without manual import, during game?

  1. #1
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Flipping Image without manual import, during game?

    I'm going to try to have a game where it may consist of multiple sprite frames, so probably 100 something? So I want to condense the amount of sprites/images per character I add into an object.
    Instead of manual flipping and adding the same sprites facing in the other direction, I was wondering if I can import all the sprite frames facing one direction only, and then program it to have them flipped, facing the other direction during game play? I tried using scale -1, but that just makes them invisible.

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,282
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    I don't know how I've been using MMF this long and never tried this, but I also ran into the lack of -1.0 scale support this morning. Can this be added to MMF?

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A bit of a workaround, but could you use a shader that flips the animation? (I think that there's one available by default.)

  4. #4
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,538
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The most efficient method in most cases is to simply do exactly what you were trying to avoid- copy the flipped animations for all sprites in an opposite animation. In my own project, for having multiple objects sprites in one object, I use 16 different animation sequences per direction, with a flag controlling if the object is flipped or not, and the objects animation set to "+16*Flag". This doesn't necessarily double the overall memory used for object animations, as they compress down pretty efficiently as mirrors of each other.

    As DavidN says, you can use a HWA shader to flip the image as its rendered, but this won't apply to gameplay effects like collision detection. There should be a default shader available for flipping iirc, otherwise its very simple (pixel.x = -1*pixel.x But a shader isn't as good a method as just saving a reversed image hardcoded in. Besides not affected collision detection or similar software level concerns, shaders add a somewhat significant GPU burden to a game which would be unnecessary (all MMF2 shaders are pixel shaders, not vertex shaders, so particularly inefficient for large textures) and shaders limit the runtimes you can export to- HWA shaders only work in .exe windows files, other runtimes have specific shader support that is cross-incompatible, and for example anaconda can use OpenGL, while HWA is DX9

    In MMF2's animation editor its not very hard to create a flipped animation. Just right click an animation direction, select "create opposite direction", then go into that opposite direction and right click it and flip vertically. So even if you had great sequences of animations it never takes too terribly long to go through and clone them all

  5. #5
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    I know it's not hard to create a flipped image. Though I was just wondering if possible in terms of memory when exporting. I also wouldn't mind support for -1.0 image flipping. I don't know why they go invisible when you do this.

  6. #6
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,538
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    MMF2 has only positive scaling. A scale of -1 is the same as 0; the object has 0 width, 0 height.

    Each method of image flipping has its own drawbacks and advantages. The memory needed for hardcoded sprites is doubled at runtime, but both the uncompiled .mfa and compiled .exe or other export will be compressed and take barely any extra size. So unless you're really worried about RAM footprint, which you really shouldn't be, that's the way to go. Save shaders for more advanced, nonhardcodable effects

  7. #7
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    The thing about flipping here in MMF2 games is, in old 2D games, there was only one sprite existed in the tile set looking in one direction. It was mirrored by the games code. If this sprite was changed in the games code, it was changed facing the other direction.

    In MMF2 Games, if I change a sprite facing right, in order to make the same changes of the same sprite but for facing left, I would need to apply the flip selection every time, thus making more work than necessary.

    While having internal sprite flipping in direction left & right to begin with has advantages, sometimes it has disadvantages.
    For example, the advantage is different shading on sprite, or holding a weapon in one hand instead of changing hands the weapon is held, depending which game you're trying to simulate.
    However, in most common fighting games, the game assumes to have sprite flipping in code form, instead of manual flipping for the other direction, ala graphic importing in MMF2/CTF. So to simulate the effect, every time I import a sprite of a character facing right, then I have to keep flipping the sprite changes for facing left as well.

    Importing same sprites, then flipping them is a little more work than necessary, but I guess whatever I can get by to make ti work correctly.

    Oh yea, not to mention that I have to do this at least twice in MMF2/CTF2.5. One character object to be controlled by Player 1, and the other same character object, but to be controlled by player 2. Unless there's a way to create the same object but to change its controls to be used by player 2 instead.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Aeolian's Avatar
    Join Date
    Dec 2013
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would just like to point out that the methods described here are choosing where to place the burden on the program.
    Flipping the images and then importing them takes more memory.
    Trying to flip the image at runtime taxes the cpu/gpu more.
    It would seem that placing the burden on memory has a signficantly less effect than placing the burden on the CPU, especially on mobiles.

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleXNA Export Module
    DistantJ's Avatar
    Join Date
    Jan 2008
    Location
    Gloucester, UK
    Posts
    2,142
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Flipping Image without manual import, during game?

    This is a feature we definitely need, most competitor development environments have this feature.

  10. #10
    Clicker Fusion 2.5 DeveloperSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,306
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    ^ This. So much of this. Please!

    I've done some programming with things like MUGEN, and they even have option to flip images at run time. I would imagine things like VB, and/or C++ have a similar programming method for flipping images.

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Flipping a Image & Animation
    By Merrie in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 5th February 2015, 04:20 PM
  2. Any extensions able to import image from file selector
    By Apex in forum SWF/Flash Export Module Version 2.0
    Replies: 0
    Last Post: 4th November 2011, 12:04 PM
  3. Image Import options annoyances
    By Tiles in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 28th December 2009, 01:56 PM
  4. Image Import Crash (Repeated 5x in a row)
    By BrandonC in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 2nd July 2006, 09:32 PM
  5. Image import bug
    By Syp3r in forum Multimedia Fusion 2 - Technical Support
    Replies: 25
    Last Post: 1st July 2006, 03:42 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
  •