hi, after hunting the internet i found loads on the intersect command, however, what i wanted i couldnt find this is what i am trying to do,

if the top of sprite 5 intersects i then
beep
end if

however i cannot work out how to only make it so that if the top, or bottom or left and right intersect another object. Is this possibe?
i just cant workit out
The intersect and intersects are two different things, so watch out for that. There are some reasons why I think you may not even want to use intersects, but if you do then you'll need to test against each sprite. Assuming your i variable is part of you doing that already, then the approach could be something like this:

hitsomeone = false
others = [1,2,4,7,23,34,56,78] --other sprites you want to check against
repeat with i = others
if sprite s intersects a then
hitsomeone = true
exit repeat
end if
end repeat
if hitsomeone then beep


Now, reading what you've said some more it may be that you're trying to just detect the top intersecting if the sprite is moving upwards, and only the bottom if it's moving downwards (in other words you're doing something like Pong or Breakout). There's the inside function that might work for you. Like this:

hitsomeone = false
others = [1,2,4,7,23,34,56,78] --other sprites you want to check against
tl = point(the left of sprite s,the top of sprite s)
tr = point(the right of sprite s,the top of sprite s)
repeat with i = others
if inside(tl, the rect of sprite a) or inside(tr, the rect of sprite a) then
hitsomeone = true
exit repeat
end if
end repeat
if hitsomeone then beep


That would test just the top left and top right of the sprite.

[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]

Reply via email to