3,000 Moving Objects at 60 FPS using Blitting! page 2

33 posts

Flag Post

Animation is pretty easy- feel free to check out the link for the source I posted. Here is my AnimatedSprite class, that I’ve recently implemented a half-blitting half-displayobject thing going on. Instead of drawing directly to the canvas like I do here, I draw it to itself. This may be slower, especially with 3,000 of them, but when only having a few performance wouldn’t be impacted.

Btw, in order to use the Animated Sprite class you’re also going to want my SpriteSheet class

 
Flag Post

shape-changing object

I’m guessing shape tweens?

 
Flag Post

Characters that can jump or duck, projectiles that change size, that kind of thing.

 
Flag Post
Originally posted by BobJanova:

Characters that can jump or duck, projectiles that change size, that kind of thing.

I think you have a fundamental misunderstanding in how these things work. A character ducking is merely an animation of the character ducking, at the same time as whatever means you use to have a hitbox, is also shrinked into the ducking shape. If one is really lazy and just use pixel perfect collisions, the animation itself reduces the size of the hitbox, due to simply being smaller.

A bullet becoming bigger is merely an animation of the bullet becoming bigger, while the hitbox of the bullet also becomes bigger.

Certantly you can make some sort of class to automate this and call it shape-changing, but it’s not a real “thing”. If you want higher level constructs like “shapes” and whatnot, either use the flash classes or make your own, you can ever power it with a regular blitting engine, although blitting is more for images rather than shapes.

Having that sort of thing falls outside of the scope of a “blitting engine”, sans maybe pixel perfect collisions (which people really shouldn’t use).

 
Flag Post

No, I understand. The demo is blitting many copies of the same small, unchanging image. Animations (and yes, changing the shape of an object is a kind of animation) mean you have to use a different image each frame, so if RTL’s solution was doing something clever with caching or image reuse then it could make a difference.

 
Flag Post
Originally posted by BobJanova:

No, I understand. The demo is blitting many copies of the same small, unchanging image. Animations (and yes, changing the shape of an object is a kind of animation) mean you have to use a different image each frame, so if RTL’s solution was doing something clever with caching or image reuse then it could make a difference.

I’m not sure you do understand. Asking if a blitting engine has morphing animation kinda indicates you don’t grasp the difference between bitmap image and vector shapes. A vector image is just a bunch of geometrical shapes that when drawn makes up an image to the human eye (a circle and a few lines can make a stickman).

By modifying the shapes over time you can give the illusion of growth, shrinking, and other transformations. A bitmap image is a grid of pixels. You can resize it or even rotate the grid, but you cannot morph it, as there is really nothing to morph.

All animations are really the frame-to-frame thing you describe, the only difference is that the vector shapes produces an image “on the fly”. It doesn’t somehow get around the need for an animation to be built out of several frozen images.

 
Flag Post

It would have been painfully obvious how this works if someone would have just looked at the AnimatedSprite class.

 
Flag Post

Well i just give you an other exmple of blitting made by Iann Lobbs it is quite funny:
http://blog.iainlobb.com/2010/11/bunnylandmark-new-flash-game-benchmark.html

I use the blitting in my FlashGameMaker engine open source and easy to use:
http://code.google.com/p/flashgamemaker/downloads/list

source code of the implementation of the blitting:
http://flashgamemakeras3.blogspot.fr/p/news.html

Enjoy