PDA

Click to See Complete Forum and Search --> : moving object and animation


skapunk52
Nov 5th, 2001, 04:23 PM
hey i can make a image move around and such but i want to make it so if i had a little guy his legs would move and he wouldnt have a white background. How would i do this?

mlewis
Nov 6th, 2001, 06:08 PM
Create a set of graphics (frames like in movies) and make them on a black background.

Create the same graphics except on a white background and the image is just a shadow (all black)

Use BitBlt to copy the shadow (mask) with vbSrcAnd

Use BitBlt to copy the black backgrounded pic over the mask with vbSrcPaint

Voila

joink
Nov 9th, 2001, 01:01 PM
Try Fox's Site, Theire's an animation programe there,
really good

spyplayer
Nov 9th, 2001, 01:49 PM
Not the transparent image using bitblt but the moving the legs thing..... how do you make the image or "guy" have his lefs moving while he moves across the screen

I know how to make the guy move




Private sub timer1_timer()

imgguy.left = imgguy.left - 1

end sub




But how would you make his legs move while he is moving..... you probably have to get 2 different pics but how would you make them appear like that.....


Thanks for all the help.

mlewis
Nov 10th, 2001, 12:17 PM
Like I said, use frames (like stop motion animation)

PLEASE don't tell me you don't know how basic animation works...you have about 25 or 30 frames per second, each frame is a still picture, so that when you draw them quickly they appear to be moving.

Have a control array of picture boxes that store the separate frames, and a variable that tracks the current frame. Whenever you move the actual image, you have to change the frame.

Don't use actual picturebox/imagebox controls that move around; rather, have a big picturebox that doesn't move, and move the coordinates for bitblt.

Sastraxi
Nov 10th, 2001, 01:19 PM
Some things that might trip you up:

1. Bitblt: See my example (http://vbden.tripod.com/articles/bitblt.htm).
2. The animation doesn't loop: Add 1 to the frame counter but use the MOD command afterwards, eg.FrameNum = FrameNum + 1 Mod NumFramesIn this, if you had 4 frames and their indicies were 0 to 3, then the code would work. If the indicies are 1 - 4, you must add 1 to the end result when you're using the index, eg.Frames(FrameNum + 1).hDC

spyplayer
Nov 11th, 2001, 03:08 AM
Ok mlewis..... Dont pee your pants..... By the way thats a stupid way of doing it...... :cool: There must be a way of doing it without soo much code! I dont want to have 30 different frames on 1 page and I am sure as hell not going to bitblt 30 pics............ :p:eek:


:eek: I am going to blow a *%*%*%*%* :eek:

mlewis
Nov 11th, 2001, 11:48 AM
Sorry. Animation is done in frames, that's it. There's no other way to do it.

If you want a full second of animation, you need 30 frames for it to look good. Five seconds needs 150 frames. Ten seconds needs 300...you get the idea.

You can lump all of the frames into one picture, and just bitblt different portions of the pic, but you just have to use frames, sorry.