2
\$\begingroup\$

So my environment is all set up and now I'm working on the movement physics of my character. I used blitting to copy over my tiles from a tilesheet. But since they are static, they are only copied over once. And with the Hero (main player character), I figured that I might blit him into his continuously changing position. But now, I'm not quite sure it's necessary?

Is there a real big perfomance-save to copy the Hero sprite into a new position constantly using Blitting, OR, is it fine to just copy it into the game once, and simply move the Hero sprite as a movieclip?

\$\endgroup\$
  • \$\begingroup\$ Can you give us some more information? Is your original art vector? How many objects are going to be drawn at once? The more specific you are, the more specific I can make my answer. \$\endgroup\$ – AttackingHobo Jun 9 '11 at 18:51
1
\$\begingroup\$

If you are moving 1 simple object around, blitting will not give you any performance increase.

But if you want tons of complex objects, particles and enemies, you should probably use blitting for everything.

\$\endgroup\$
  • \$\begingroup\$ Thanks for clearing that up. What if I wanted particles for visual effects, could I still JUST Blit those and still leave my User-controlled character still be moved around as a MovieClip? I guess what I'm asking is if it's normal to combine the blit method with simply moving Movieclips? \$\endgroup\$ – Kid Jun 9 '11 at 23:45
  • \$\begingroup\$ @Kid, you should probably blit the player to a bitmapdata, and then have a bitmap that uses that bitmapdata, and apply rotations, scaling, position and all transformations to that. \$\endgroup\$ – AttackingHobo Jun 10 '11 at 0:54
  • \$\begingroup\$ Sorry for the delay, been away. Ok so I think that is what I am doing. Look, first I copy (with copyPixels) the Hero-sprite from a Tilesheet that I have imported into the Library. Then I addChild(Hero) and move that child around. That Hero variable is of :Bitmap data type. Does this sound about right? \$\endgroup\$ – Kid Jun 12 '11 at 23:29
  • \$\begingroup\$ Yeah that sounds right. Draw everything to the bitmapdata of the hero bitmap, and just move and transform the bitmap however you need to. \$\endgroup\$ – AttackingHobo Jun 12 '11 at 23:39
1
\$\begingroup\$

A MovieClip still needs to be rendered by the Flash Player. If it's a animated vector shape, it will take longer than blitting a bitmap. But as AttackingHobo said, you might not see the difference with only one sprite.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.