Page 1 of 1

[HELP] (Picturebox.Location) .fail game

Posted: Thu Dec 17, 2009 6:55 pm
by hiyadutch
Hey,

I'm trying to create a simple game but i need to know how to give a message when the block falls out of the form.
or to right or to left of the form.

i know that you can change the location of the picturebox with
PictureBox1.Location = New Point(100, 100)

i need to make somthing like

If picturebox1.location = (200,200) then
msgbox "FAIL"
end if

somthing like that or

if picturebox1.location.X = 200 and picturebox1.location Y = 200 then
msgbox "Fail"
end if

or

if picturebox1.location.X.Y = (200,200) then... enz

I hope you understand what i mean.

Re: [HELP] (Picturebox.Location) .fail game

Posted: Thu Dec 17, 2009 8:48 pm
by CodenStuff
Hello,

Something like this maybe:

Picturebox goes off top:
Code: Select all
If PictureBox1.Location.Y < 0 Then
            MsgBox("Fail")
        End If
Picturebox goes off bottom:
Code: Select all
If PictureBox1.Location.Y > 200 Then
            MsgBox("Fail")
        End If
Picturebox goes off left:
Code: Select all
If PictureBox1.Location.X < 0 Then
            MsgBox("Fail")
        End If
Picturebox goes off right:
Code: Select all
If PictureBox1.Location.X > 200 Then
            MsgBox("Fail")
        End If

Should work.

Re: [HELP] (Picturebox.Location) .fail game

Posted: Fri Dec 18, 2009 2:31 am
by NoWayIn
Use a timer ? I think that's what you're looking for

Put
Code: Select all
If picturebox1.location = (200,200) then
msgbox "FAIL" 
end if 
Put that into a timer, set it to Enable = True, Interval = How ever many seconds you you want to check ; per tick

1000 = 1 second

Re: [HELP] (Picturebox.Location) .fail game

Posted: Fri Dec 18, 2009 3:48 am
by Robby
lol good idea use timers in a game but u should use darkbasic to make a game as i m not sure how easy it will be to code one in Visual Basic

Re: [HELP] (Picturebox.Location) .fail game

Posted: Fri Dec 18, 2009 1:41 pm
by hiyadutch
thnx but i think i just keep it visual basic for now

Re: [HELP] (Picturebox.Location) .fail game

Posted: Fri Dec 18, 2009 2:00 pm
by hiyadutch
Codenstuff code works fine thnx btw i already tried that nowayin