Help in Basic

Discussion in 'Software' started by ascii13, Nov 23, 2003.

  1. ascii13

    ascii13 Private E-2

    Ok , i've tried to do little soft in basic that would make a ball rebound in a frame, i've made my code and VB does not detect any error but everytime i try to run it, vb crashes (or the program crashes, if i try to run the EXE)

    now is my code, help me find my error:

    Private Sub quitMENU_Click()
    End
    End Sub

    Private Sub startMENU_Click()
    Dim x As Integer
    Dim y As Integer
    Do
    x = Val(Ball.Left)
    y = Val(Ball.Top)
    Loop Until y = 0
    Select Case Ball.Left And Ball.Top
    Case x < 121
    Do
    Ball.Left = Ball.Left + 1
    Loop Until Ball.Left = 7800
    Case x > 7799
    Do
    Ball.Left = Ball.Left - 1
    Loop Until Ball.Left = 120
    Do
    Ball.Left = Ball.Left + 1
    Loop Until Ball.Left = 780
    Case y > 4919
    Do
    Ball.Top = Ball.Top + 1
    Loop Until Ball.Top = 120
    Case y > 119
    Do
    Ball.Top = Ball.Top - 1
    Loop Until Ball.Top = 4920
    Case Else
    Do
    Ball.Left = Ball.Left + 1
    Loop Until Ball.Left = 120
    Do
    Ball.Top = Ball.Top + 1
    Loop Until Ball.Top = 4920
    End Select
    End Sub


    THX alot for any advice
     
  2. ascii13

    ascii13 Private E-2

  3. Corporal Punishment

    Corporal Punishment Head of Software Shenanigans Staff Member

    try replacing

    Case y > 119

    with

    Case y < 119

    Just a quick guess.
     
  4. iamien

    iamien Cptn "Eh!"

    fidn otu what value you are putting into y
    you dont deal with y behidn less then 119
     
  5. ascii13

    ascii13 Private E-2

    unless i made an error in my code, y is not supposed to be under 120, so that's no problem
     
  6. Corporal Punishment

    Corporal Punishment Head of Software Shenanigans Staff Member

    If that's true than this "Loop Until y = 0" shouldn't happen.
     
  7. iamien

    iamien Cptn "Eh!"

    Basic not my language and i was tierd and read it wrong.
    When your assigning the x and y, i onyl see you assigning it once, and after that you keep checking its location, but you are modifing just the location of ball with ball.member. So when you check the X and Y's are you not just check the initaly values that were put there. dont knwo basic but unless you were using pointers, dereferncing them and so forth, it wouldn't work.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds