I am fucked and need you're help (VB6 CODERS)

St4nley

Member
Apr 13, 2013
469
76
TO MAKE A LONG STORY SHORT, FINAL PROJECT DUE MONDAY, AND I CHOSE THE WRONG GAME
so now i am making billards
and right now, im fucking stuck and i feel like a noob because i am

how do i make a shape that is a ball stay remaining in one spot untill it is hit (billiards)

Code:
Private Sub Timer1_Timer()
imgball.Top = imgball.Top - goodVel
shpBall.Top = shpBall.Top - BallHVel
 
'IF PLAYER BALL HITS BOTTOM
If imgball.Top + imgball.Height > Form2.ScaleHeight Then
goodVel = goodVel * -1
End If
 
'IF GAMEBALL HITS TOP
If imgball.Top < 0 Then
    goodVel = goodVel * -1
End If
 
'IF GAME BALL HITS BOTTOM
If shpBall.Top + shpBall.Height > Form2.ScaleHeight Then
BallHVel = BallHVel * -1
End If
 
'IF GAME BALL HITS TOP
If shpBall.Top < 0 Then
    BallHVel = BallHVel * -1
End If
 
'///////////////IF THE WHITE BALL HITS THE GAME BALLS\\\\\\\\\\\\\\\\\\\\\\
If imgball.Top < shpBall.Height + shpBall.Top Then
    goodVel = goodVel * -1
    BallHVel = BallHVel * -1
End If
 
End Sub
 

St4nley

Member
Apr 13, 2013
469
76
yeah
So it hits fine, but the balls are floating around the place until they're hit?
exactly, they are floating and i dont want them to float, i had also added this in the meantime

Code:
Private Sub Form_keydown(keycode As Integer, shift As Integer)
    If keycode = vbKeySpace Then
        goodVel = goodVel * 1
        imgball.Top = imgball.Top - goodVel
       
    End If
End Sub


it basically says that if i hit space bar, then that ball will move up but its also fucked because i have to hold space for it to move,
but i want to just float after i hit space so now i have 2 issues

BALL FLOATS WHEN I DONT WANT IT TO
BALL DOESNT FLOAT WHEN I WANT IT TO
IRONIC?
I THINK SO

EDIT: I FIXED THE ISSUE WHERE I HAD TO HOLD SPACE HERES WHAT I DID
Code:
goodVel = imgball.Top - shpBall.Height - shpBall.Width

I SAID THE DISTANCE FROM THE TOP OF MY WHITE BALL THE USERS BALL AND THE DISTANCE FROM THE GAME BALL YOU WANNA HIT IS THE DISTANCE IT MUST TRAVEL

SO WHAT PROBLEMS DO I FACE?
THE BALLS ARE FLOATING WHEN I DON'T WANT IT TO
PLEASE HELP!
 

Weed

Member
Jul 11, 2010
31
2
Uhm, when the white ball collides can you set a boolean to "True" which then allows it to move, and it's false until then?

From what I understand it's velocity is set beforehand, so make the boolean signify setting a velocity or not.
 

St4nley

Member
Apr 13, 2013
469
76
i simply set the BallHVel to 0 and i said
if the ball collides with the other ball then ballhvel = ballhvel1 (which i set to like 50) * -1
so i solved that problem

next problem:
i don't know the function or event for how to move the ball with my mouse :(
if i don't fix this then billiards game will be impossible
 

Users who are viewing this thread

Top