I build a game in excel visual basic but I cant seem to detect collisions. Anyone have any idea how to do this
Sub Form1_KeyDown(allthestufftodetectwhichkeyisbeingpressed)
if left = char("leftasciichar") then
image.left = image.left -10
end if
dim widthleft as integer
dim height as integer
if image11.left >= image2.left then
widthleft = image2.left + image2.width
if image11.left <= widthleft then
if image11.top >= image2.top then
height = image2.top + image2.heaight
if image11.top <= height then
msgbox("you ahave hit the bounds")
end if
end if
end if
end if
end sub
this doesnt work though if anyone knows how to detect collision in vba which is excel vb.
i cant use vb6 syntax because vba doesnt have all the syntax which is why i have to use the multiple if then statements
anyone know.
How do I detect Picture box collisions in VBA?
Page 1 of 12 Replies - 955 Views - Last Post: 18 November 2011 - 07:02 AM
Replies To: How do I detect Picture box collisions in VBA?
#2
Re: How do I detect Picture box collisions in VBA?
Posted 17 November 2011 - 08:27 PM
or rather how do i make a loop function to determine if its left is between two ranges ie
dim leftright as range 1 to 15
if image.left = leftright then
do this
end if
is that even possible
dim leftright as range 1 to 15
if image.left = leftright then
do this
end if
is that even possible
#3
Re: How do I detect Picture box collisions in VBA?
Posted 18 November 2011 - 07:02 AM
Here's a loop that will stop when you go off the left edge of the form:
Do Until Image.Left <= 0
Image.Left = Image.Left - 1
Loop
Maybe that will get you started?
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|