A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: [Flash 8] copyPixel animation and Accessorizing

  1. #1
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988

    [Flash 8] copyPixel animation and Accessorizing

    Conceptually, it is based on a technique I used in Director to animate the bunnies in my King of the Bunnies game (which I remember posting on this board a lifetime ago).

    http://willoughbyweb.com/sprite/gohen.html

    This is something similar to what Senocular has done; however, I didn't download his source file until after I finished. However, I took it a step further and allowed the Gohan sprite to be accessorized.

    The basic technique takes a sprite-sheet, copies a certain sprite on that sheet and places it on stage. After a certain amount of time, it will display another sprite from that sprite-sheet.

    To do the accessorizing, first, I opened the sprite-sheet in Photoshop. Then I drew all the accessories in different layers and exported them individually.

    Whenever an accessory checkbox is clicked, it adds that data to an object, and then cycles through the object’s accessory data and copy pixels that overtop the sprite-sheet.

    DOWNLOAD SOURCE: http://willoughbyweb.com/sprite/gohen.fla

    -pXw

  2. #2
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    cool. sprite sheets are a whole lot smaller than multiple images too
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  3. #3
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I like the idea
    Have you tested the speed of this? Would it be faster to place bitmaps in frames and let Flash run through them?

  4. #4
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Quote Originally Posted by tonypa
    I like the idea
    Have you tested the speed of this? Would it be faster to place bitmaps in frames and let Flash run through them?
    I've only speed tested it verses what I tried to do awhile ago, which was a vector based "change how your character looks" type game. The more accessories that are visible, the slower the characters started to become. When I tried using pieces of bitmaps, it often resulted in the ugly: "looks like a cut up bitmap look".

    This allows you to add as many accessories as you want to the character and then assemble the sprite-sheet on the fly. Since it's always just copying from the spritesheet, there's no issues really with too many movieclips on-screen.

    I'll do a speed test version just the bitmap alone tonight.

    -pXw

  5. #5
    Senior Member sand858's Avatar
    Join Date
    Aug 2001
    Posts
    327
    That's hot. I'm interested in hearing about speed differences.
    gamedozer games
    Free multiplayer and singleplayer games

  6. #6
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    This is the sprite animated using the timeline:
    http://willoughbyweb.com/sprite/gohenO.html

    This is the sprite using the draw/copyPixel style:
    http://willoughbyweb.com/sprite/gohenX.html

    Let me know the FPS, okay?

    -pXw

  7. #7
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    just about exactly the same fps for both. 23-26
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  8. #8
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    Yup same fps for both..
    I don't think such a small thing will have much impact on the player, there should be something bigger to check. Maybe a bigger image (more alpha) and more sprites?

  9. #9
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    nice one =)
    and yeah,saphua is right, for a performance comparison set the movie to 120 fps and fill it with as much performance intensive things as possible, so really big sprites with lots of alpha areas,lots of elements placed on top of each other etc.

  10. #10
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Okay... I'll do that later Tom.

  11. #11
    \x3a\x6f\x29
    Join Date
    Sep 2005
    Location
    paris
    Posts
    88
    Using BitmapData should be faster or you have a lot of work to do.
    For example, you could create all possible arrangements of addons like the sword etc. in movieclips. This should be the fastest way, but it's not very good if you have about 10 addons

    The other way - slower - creating the sprite and addons dynamically in movieclips. Should be a little bit slower than the first method.

    For fast and dynamic use the BitmapData is in this case absolutely perfect. You can precalculate all (!) animations for example and just load them if needed. This would be the fastest way imho.

    Another possibility is not precaching every (possible) frame and generating the bitmap/animation at runtime. I think WilloughbyJackson is doing this. So you could gain a little bit more speed by precaching everything.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center