-
Hi, I start to program a little game. You move a man.(pictureBox) with 4 command(up, down, left right). I use the picture.left and picture.top to move the man. My problem is that I want to put some obstacle like box to create a maze. I dont want that the man pass over the box! Do someone have a trick ? These obstacle will be picturebox too.
If something is not clear, e-mail me or ask what you don't understand in this forum.
Thank you and sorry for my english, i'm french:)
-
Try this
code:
If pic1.Left + pic1.Width > pic2.Left And pic1.Top + pic1.Height > pic2.Top Then
If pic1.Left < pic2.Left + pic2.Width And pic1.Top < pic2.Top + pic2.Height Then
'here goes the action for the collision
-
*hehe*recognizs his code*
erm well, if you want to make a maze you probably want to use a map to store where you can walk. That makes collision unneccessary since you can just check if the maps there 0 (empty) or higher (number of picture there).
Hope this helps
-
ok....
Like I said i'm a newbie... I will check this but I don't know if I will be able to do this...
Will check this in the weekend and give you news!
Tanx
-
What code for colision
Can you give me an example of the code for a colision and where can I paste the code.
And can you change de pic1 and pic2 for
picMan
picRock
Cause i'm not sure where to paste it
Thank you!