Advertisement Jump to content


This topic is now archived and is closed to further replies.


2D anim question, is there a faster way..

This topic is 6217 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

than drawing all the frames(bitmap) if you want to do a little animation? like for example a person running, do i really need to draw each and every steps it makes?

Share this post

Link to post
Share on other sites
well, you can perform 2d interpolation between keyframes of 2d images, but most likely, this would look incorrect or unnatural when rendering the interpolated pixels. this would NOT be a faster way, since you take processor time trying to calculate where the interpolated pixels would be, but it certainly is the alternative. the advantage would be to save up on disk space and loaded memory, but it would detract from speed. most, if not all 2d games pull the particular frame of animation from a bitmap. it''s worked for how many years, so this is probably the best way to go.


Share this post

Link to post
Share on other sites
2D interpolation between keyframers of 2D images? interpolated pixels? plz, i''m sorry i don''t understand what''s you''re saying... and you said it''ll be slower? well, is their any other way...? thanks a lot for your time

Share this post

Link to post
Share on other sites
i don't think there's any other way to do 2d animation
(unless you use accelerated hardware)
you just have to find out better way to draw those pixels,
like not to calculate pointer for every pixel, but do it like

int q=ypos*screenwidth+xpos;
int w=0;
for (int yloop=0; yloop < pictureheigth; yloop++) {
for (int xloop=0; xloop < picturewidth; xloop++)
q+=screenwidth; w+=picturewidth;

quite a crappy code and propably useless, but it could help.
ofcourse you have to add checking for transparent pixels and
borders and whatever blablabla

(wtf? why this fucks up my code?)

Edited by - astu on January 10, 2002 2:51:02 AM

Share this post

Link to post
Share on other sites
astu: no no not that kind of animation, that''s moving right? i mean okey not a person running... a exploding car! there... it''s just sits still there then suddendly it explodes! how do i animate that? thanks!

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Well, if it''s an explosion, then you''ll need quite a number
of frames. For this kind of stuff, you can use a particle
engine. Basically, you create a number of particles, which
are objects for which you simulate a trajectory. Particles
have a position, speed, and are subject to forces (the main
one being gravity, and the impulse you give it at startup).
Particles have a size, a color (or a texture (or both)), and
any other property you can think of.

The exploding car itself will either have to be removed from
the scene when exploding, or be animated the "normal" way
(with keyframes). Or you can assign some of your particles
textures of car parts, and throw them around, like the other
expliosion particles (though with more weight, probably, so
they fall faster, land closer, etc).

To start the explosion:
1 - create a number of particles at the explosion point
2 - give each of them a somewhat random velocity, away from
the explosion point (if it''s on the ground, mainly upwards)
3 - give them a somewhat random speed (the stronger the explosion
the larger the speed)
4 - each tick, move each particle by an amount equal to its
speed, in the direction where it is going
5 - each tick, apply all the forces (eg gravity) that apply
to the particle to its direction vector (direction scaled
by speed)
6 - draw them all

Share this post

Link to post
Share on other sites
There are two ways to do it. And both ways can be combined. One way is you just build up a number of frames for the explosion, then animate them within your program, with enough delay to make it look realistic. ie draw frame1,frame1,frame1,frame2,frame2,frame2,etc...

The next way is to create particle effects. I have never done this yet, so I don''t really know how to do it. I just know you can combine it with the animation to make a better looking explosion.

Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home

Share this post

Link to post
Share on other sites
captainjester: yup that''s just what AP said, well we just have to learn that if we don''t want the hard way... or is that the hard way?

anyway thanks guys for all your replies!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!