[HELP] (Picturebox.Location) .fail game

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
6 posts Page 1 of 1
Contributors
User avatar
hiyadutch
New Member
New Member
Posts: 18
Joined: Thu Dec 10, 2009 8:45 pm

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.
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4392
Joined: Tue Aug 04, 2009 1:47 am

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.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
NoWayIn
VIP - Donator
VIP - Donator
Posts: 444
Joined: Sat Nov 21, 2009 11:16 pm

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
User avatar
Robby
VIP - Donator
VIP - Donator
Posts: 417
Joined: Mon Aug 03, 2009 4:01 am

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
My current Projects Listed Below:
Toixt++ Text Editor Just 10 or less more features to go!
Image
Image
User avatar
hiyadutch
New Member
New Member
Posts: 18
Joined: Thu Dec 10, 2009 8:45 pm

thnx but i think i just keep it visual basic for now
User avatar
hiyadutch
New Member
New Member
Posts: 18
Joined: Thu Dec 10, 2009 8:45 pm

Codenstuff code works fine thnx btw i already tried that nowayin
6 posts Page 1 of 1
Return to “Tutorial Requests”