Results 1 to 7 of 7

Thread: Flipping images is a nightmare!

  1. #1

    Flipping images is a nightmare!

    I'm trying to do this platform game, and I want to flip the sprites when the player moves to the opposing part of the screen. My problem is that I don't know how to flip an sprite (I don't want to do two animations per move, like walking tto the left, walking to the right, etc...).

    I have tried to do a StretchDraw with the x coordinates of the TRect swapped, but the StretchDraw of the TDXImageList doesn't support that and instead I get nothing.

    In my second attempt, I tried to use the StretchDraw from the Canvas, in the surface. I manage to flip the image, but it doesn't draws it with tranparency.

    I'm getting frustrated with something so simple, and I don't want to do two animations per moves (you know, my image library will get a tremendous size).
    <i>I know my English sucks, so please I only ask for some patience.<i>

  2. #2

    Flipping images is a nightmare!

    IIRC there was a thread about this some time ago. Not sure if it included a solution though.

    In any case. There's no flipping images function in DelphiX. If you want to do this, then you'll need to write it yourself. It should be posssible with scanline.

    IMO I think its much less of a hassle to go through making the extra images.

  3. #3
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Flipping images is a nightmare!

    Or write a program to externally flip all your images. Then you dont have the hard work to do. A program will need a very large amount of images to cause a screen card memory problem anyway.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #4

    Flipping images is a nightmare!

    Thanks for the ideas, I'm starting to consider the extra sprites (for this game). Still, I'm interested in making the images flip on run-time, because I'm going to start a big project soon, and I'll need this function (I have to economize a little).

    I'm going to try with scanline, thanks again!
    <i>I know my English sucks, so please I only ask for some patience.<i>

  5. #5

    Re: Flipping images is a nightmare!

    Quote Originally Posted by enker
    I'm trying to do this platform game, and I want to flip the sprites when the player moves to the opposing part of the screen. My problem is that I don't know how to flip an sprite (I don't want to do two animations per move, like walking tto the left, walking to the right, etc...).

    I have tried to do a StretchDraw with the x coordinates of the TRect swapped, but the StretchDraw of the TDXImageList doesn't support that and instead I get nothing.

    In my second attempt, I tried to use the StretchDraw from the Canvas, in the surface. I manage to flip the image, but it doesn't draws it with tranparency.

    I'm getting frustrated with something so simple, and I don't want to do two animations per moves (you know, my image library will get a tremendous size).
    There is a function within DIB.pas called mirror. You can choose if you want to mirror horizontally or vertically. Did you took a look at it?

    Greetings,
    Dirk
    <a href="http://www.greatgamesexperiment.com/game/Valgard/?utm_source=gge&amp;utm_medium=badge_game"><img border="0" alt="GGE" title="GGE" src="http://static.greatgamesexperiment.com/badge/game/valgard/gge400x56.png"></a>

  6. #6

    Flipping images is a nightmare!

    Nope, but seems like a very good option! thanks for the help!
    <i>I know my English sucks, so please I only ask for some patience.<i>

  7. #7

    Flipping images is a nightmare!

    It's very easy to flip a tbitmap horizontally with scanline

    Code:
    for y &#58;= 0 to Bitmap.Height - 1 do begin
      LRowIn &#58;= Bitmap.Scanline&#91;y&#93;;
      LRowOut &#58;= BitmapOut.Scanline&#91;y&#93;;
      for x &#58;= 0 to Bitmap.Width - 1 do begin
         LRowOut&#91;x&#93; &#58;= LRowIn&#91;Bitmap.Width - x - 1&#93;;
      end;
    end;
    something like that (not tested).

Bookmarks

Posting Permissions

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