vb.net - how to make a picturebox.enter event -
i trying make game . using pictureboxes . concept when pcbox hit other 1 adds points . wanted event mouse enter pictureboxes ( when picture box enters other 1 ) . tried code isn't efficient
if pc1.left = pc2.left - 120 call msgbox("whatever") elseif pc1.left = pc2.left + 120 call msgbox("hit") endif
you should avoid pictureboxes flying around, here answer nonetheless:
dim rectangle1 rectangle = pc1.bounds dim rectangle2 rectangle = pc2.bounds if (rectangle1.intersectswith(rectangle2)) //whatever else //hit endif or even
if (pc1.bounds.intersectswith(pc2.bounds)) //whatever else //hit endif this detects intersection of pictureboxes, mentioned, no appropiate way of programming games in vb.net.
maybe should consider reading this guide programming simple ping-pong game (without controls actors).
Comments
Post a Comment