Results 1 to 8 of 8

Thread: moving object and animation

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    22

    moving object and animation

    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?

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    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
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Location
    Ya don't wanna know...
    Posts
    25
    Try Fox's Site, Theire's an animation programe there,
    really good
    The world would be better without

    !!!!!!!!!!!YOU!!!!!!!!!

  4. #4
    Member
    Join Date
    Nov 2001
    Location
    Heaven........ Whats that fire doing here?
    Posts
    39

    Question Im really wondering this question too

    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.

  5. #5
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    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.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Some things that might trip you up:

    1. Bitblt: See my example.
    2. The animation doesn't loop: Add 1 to the frame counter but use the MOD command afterwards, eg.
    VB Code:
    1. FrameNum = FrameNum + 1 Mod NumFrames
    In 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.
    VB Code:
    1. Frames(FrameNum + 1).hDC
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7
    Member
    Join Date
    Nov 2001
    Location
    Heaven........ Whats that fire doing here?
    Posts
    39

    Thumbs down Ok..... Mlewis............

    Ok mlewis..... Dont pee your pants..... By the way thats a stupid way of doing it...... 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............


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

  8. #8
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    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.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

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