Results 1 to 6 of 6

Thread: Bad Bitblt

  1. #1

    Thread Starter
    Lively Member nmaccari's Avatar
    Join Date
    Mar 2002
    Posts
    67

    Bad Bitblt

    Well, I am making a boxing game like the old Star Rank Boxing on the Commodore but I have a little problem. Basically, the way I am using my BitBlt, I need to have the pictures visible and fully clear in order to use them as part of the animation. Like this:

    BitBlt pic.hDC, x, Y, SpriteWidth, SpriteHeight, picMask.hDC, (FrameNumber - 1) * SpriteWidth, 0, vbSrcAnd

    BitBlt pic.hDC, x, Y, SpriteWidth, SpriteHeight, picSprite.hDC, (FrameNumber - 1) * SpriteWidth, 0, vbSrcPaint

    I don't want to have my picMask and picSprite sitting on the form for everyone to see. I just want to use them for the animation. But, if I make picMask or picSprite invisible then all I get as animation is big goofy boxes. Can anyone tell me if there is an API call or another way to do this animation?

    Thanks.
    Nick

  2. #2
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Could you post your project for us to see?

    It shouldn't matter if the picture boxes are invisible or not. Do you have their autoredraw set to true?
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  3. #3

    Thread Starter
    Lively Member nmaccari's Avatar
    Join Date
    Mar 2002
    Posts
    67

    Smile Okay

    Problem solved. Thanks. Something so simple never occurred to me. I guess I'm still new to the whole graphics thing.

    Hey, do you know a better way to change pixels within the picture box? What I'm doing now is storing the coordinates in a text file and using it to change the boxers gloves and such. The first time I looped through the whole sprite using the point method and then saved each coordinate in the file that I wanted. Then after that I just used this code below. It works but it's not pretty.

    Dim intX As Integer
    Dim intY As Integer
    Dim strColor As String

    Open App.Path & "\sampleschar.txt" For Input As #1
    With picSprite

    Do Until EOF(1)

    Input #1, intX, intY, strColor

    Select Case strColor

    Case vbYellow ' Hair
    picSprite.PSet (intX, intY), &H80000004
    Case vbBlue ' Skin
    picSprite.PSet (intX, intY), &H8080FF
    Case vbRed ' Shorts
    picSprite.PSet (intX, intY), &HFF00FF
    Case vbGreen ' Gloves
    picSprite.PSet (intX, intY), &HE0E0E0
    End Select
    Loop
    End With
    Close #1
    picSprite.Visible = False
    Nick

  4. #4
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Graphics can be a pain, and it's mostly simple things that cock it all up.

    Ok, a faster method of changing pixel colours is using the setpixel API call. You might want to look that up.

    But really, changing the colours by changing individual pixels is just painful.

    I can't really give you suggestions on how to proceed until I can see what you're doing. It's difficult working blind.

    You might want to look into using masks and blitting colour blocks about. If you make a mask of the gloves and then blit a square of colour onto the image copying only the glove section (in a similar way to blitting transparently) then that would be faster but you might have fun trying to implement it...
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  5. #5

    Thread Starter
    Lively Member nmaccari's Avatar
    Join Date
    Mar 2002
    Posts
    67

    Thumbs up Thanks Arbiter

    I'll look that API call up. I haven't written too much code yet. But, when I get some meat into it then I'll send it to you. I'm still somewhat of a novice so any suggestions you may have in the future will be appreciated. Thanks.
    Nick

  6. #6
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    I don't know if you've noticed the banner in my sig, but it's actually a link to a game that Behemoth (another member) and I are working on.

    If you haven't already downloaded it, then you may wish to do so. It will give you an idea of what can be done in VB without any third party controls etc. Bear in mind it's still work in progress.

    If there are any effects in there that you would like to know more about then give me a shout. I won't give you the code, but I will give you pointers on what to look up and help with any problems you come across (I believe people learn better if they figure things out themselves).

    I'll look forward to seeing what you've done so far - it's nice to see people making things in VB other than database programs.
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

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