|
-
May 19th, 2002, 10:16 PM
#1
Thread Starter
Lively Member
Code for collision of top of shape...
Hey..
Im trying to write my fishing program and im getting stuck on the coding for a collision which only occurs if the y2 part of the line pierces the top of a shape. The shape must be hit by the y2 part of the line not at the middle of the line or ne thing. The shape is 495 x 255 (a rectangle) and is hidden underneath a fish that scrolls across the screen. I need it so when the fisher casts his line and the line hits any part of the top of the shape then the collision even occurs. Any help?
Thanks,
edit: Ok I found out a way to work it, though it is limiting. The line before didnt completely become equal to the top of the shape :
If Line1.Y2 = Shape1.Top And Line1.X2 >= Shape1.Left Then fish4.Visible = False
so I adjusted the shape and fishes position so now it does become equal so it works...but that is limiting because now i have to make the fish in set positions if the line is to become equal. Any way around this?
Last edited by Inno; May 19th, 2002 at 10:23 PM.
-
May 20th, 2002, 10:17 AM
#2
Frenzied Member
I didn't understand the question...
-
May 20th, 2002, 10:24 AM
#3
Not NoteMe
Of the top of my head...
VB Code:
If Line1.Y2 >= Shape1.Top And Line1.Y2 <= Shape1.Top + Shape1.Height And Line1.X2 >= Shape1.Left And Line1.X2 <= Shape1.Left + Shape1.Width Then
Fish4.Visible = False
End If
If the line's X2,Y2 point is within the shape this will hide the fish, which is what you want i think.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|