Results 1 to 3 of 3

Thread: Picture box seems like cut-out

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2022
    Posts
    4

    Picture box seems like cut-out

    Can someone help me, I don't really know what to do, I've been researching and researching yet I can't still fix this. Why is my pipes looks like this? I'm creating a flappy bird game but instead I used Santa then after the original 3 pipes, the other 3 pipes looks like this. It doesn't fully cover the length it should have. Please can someone tell me what to do to fix this. And how can I add some music effects for this game?
    thank you!! I'll add the source code here.



    Private Sub Form_Load()

    picSanta.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\santa.gif")
    picSanta.ScaleMode = 3
    picSanta.AutoRedraw = True
    picSanta.PaintPicture picSanta.Picture, _
    0, 0, picSanta.ScaleWidth, picSanta.ScaleHeight, _
    0, 0, picSanta.Picture.Width / 26.46, _
    picSanta.Picture.Height / 26.46
    picSanta.Picture = picSanta.Image

    lblObstacle1.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\DOWN1.gif")
    lblObstacle1.Left = Me.ScaleWidth / 3
    lblObstacle1.ScaleMode = 3
    lblObstacle1.AutoRedraw = True
    lblObstacle1.PaintPicture lblObstacle1.Picture, _
    0, 0, lblObstacle1.ScaleWidth, lblObstacle1.ScaleHeight, _
    0, 0, lblObstacle1.Picture.Width / 26.46, _
    lblObstacle1.Picture.Height / 26.46
    lblObstacle1.Picture = lblObstacle1.Image

    lblObstacle1B.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\UP1.gif")
    lblObstacle1B.ScaleMode = 3
    lblObstacle1B.AutoRedraw = True
    lblObstacle1B.PaintPicture lblObstacle1B.Picture, _
    0, 0, lblObstacle1B.ScaleWidth, lblObstacle1B.ScaleHeight, _
    0, 0, lblObstacle1B.Picture.Width / 26.46, _
    lblObstacle1B.Picture.Height / 26.46
    lblObstacle1B.Picture = lblObstacle1B.Image

    lblObstacle2.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\DOWN2.gif")
    lblObstacle2.ScaleMode = 3
    lblObstacle2.AutoRedraw = True
    lblObstacle2.PaintPicture lblObstacle2.Picture, _
    0, 0, lblObstacle2.ScaleWidth, lblObstacle2.ScaleHeight, _
    0, 0, lblObstacle2.Picture.Width / 26.46, _
    lblObstacle2.Picture.Height / 26.46
    lblObstacle2.Picture = lblObstacle2.Image

    lblObstacle2B.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\UP2.gif")
    lblObstacle2B.ScaleMode = 3
    lblObstacle2B.AutoRedraw = True
    lblObstacle2B.PaintPicture lblObstacle2B.Picture, _
    0, 0, lblObstacle2B.ScaleWidth, lblObstacle2B.ScaleHeight, _
    0, 0, lblObstacle2B.Picture.Width / 26.46, _
    lblObstacle2B.Picture.Height / 26.46
    lblObstacle2B.Picture = lblObstacle2B.Image

    lblObstacle3.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\DOWN1.gif")
    lblObstacle3.ScaleMode = 3
    lblObstacle3.AutoRedraw = True
    lblObstacle3.PaintPicture lblObstacle3.Picture, _
    0, 0, lblObstacle3.ScaleWidth, lblObstacle3.ScaleHeight, _
    0, 0, lblObstacle3.Picture.Width / 26.46, _
    lblObstacle3.Picture.Height / 26.46
    lblObstacle3.Picture = lblObstacle3.Image

    lblObstacle3B.Picture = LoadPicture("C:\Users\home\OneDrive - Technological University of the Philippines\Desktop\BSEE FILES\FINAL ACT COMPROG\UP1.gif")
    lblObstacle3B.ScaleMode = 3
    lblObstacle3B.AutoRedraw = True
    lblObstacle3B.PaintPicture lblObstacle3B.Picture, _
    0, 0, lblObstacle3B.ScaleWidth, lblObstacle3B.ScaleHeight, _
    0, 0, lblObstacle3B.Picture.Width / 26.46, _
    lblObstacle3B.Picture.Height / 26.46
    lblObstacle3B.Picture = lblObstacle3B.Image


    santaSpeed = 0
    acceleration = 5
    obstacleSpeed = 40
    Collision = False
    Gap = 2000
    score = 0
    Timer1.Enabled = True
    cmdRestart.Enabled = False
    picSanta.Top = Me.ScaleHeight / 2

    lblObstacle1.Left = Me.ScaleWidth / 3
    lblObstacle1B.Left = Me.ScaleWidth / 3
    lblObstacle2.Left = 2 * Me.ScaleWidth / 3
    lblObstacle2B.Left = 2 * Me.ScaleWidth / 3
    lblObstacle3.Left = Me.ScaleWidth
    lblObstacle3B.Left = Me.ScaleWidth

    End Sub
    Attached Images Attached Images  

  2. #2
    Hyperactive Member
    Join Date
    Jul 2020
    Posts
    370

    Re: Picture box seems like cut-out

    As I understand it, the white parts are the wrong location of the pipes and they should cover the entire size of the Picturebox?
    Or should the Picturebox sizes change according to the uploaded pictures?
    The image of Santa has a black background. Is this how it should be?

  3. #3
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,259

    Re: Picture box seems like cut-out

    I think the reason for this is, because there is "no proper gameloop yet".

    The term "proper" involves, that you should *not* use any "Container-Objects with hWnds" (like a picBox),
    to render "moving parts" - this almost always doesn't "end up well" (when your "moving parts" will increase over time).

    Instead your Image-Resources (e.g. the Images which hold your "Pipes"), should be:
    - freshly drawn, every time inside your (new to write) game-loop-routine (often called "ReDraw" or "RenderScene")
    - via proper "Blitting-Commands" (the easiest way for a VB-Image would be via the PaintPicture-call)

    A "Blit-Call" is also "just a single line"... quite similar to a "Move"-call on a PicBox or VB-Image-Ctl,
    (basically using the same coords as your Move-call - for the Destination-Rectangle of the Blit-Op).

    Olaf

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