No Collision -
11-18-2008, 09:01 PM
I'm not sure how you could make a goal line, but the object collisions aren't so hard.
You need to create an event that checks the distance from the object that you want to move (like a car) and the object that it might collide with (like a building). An example would be something like this:
While car is at least (width of building / 2) away from building:
Begin: Do nothing
During: Do nothing
End: Car move backwards [insert number here] meters
What happens is that when the car is not touching the building, it will do nothing. When the car reaches the outside wall of the building (the width divided by 2 is to find the radius), it will move backwards. This would act as a bounce back from the collision. Whatever number you choose for the meters should be eqaul to how fast the car travels in one second, that way even if you keep trying to move forward you won't go anywhere.
There are two problems that immediately come to mind with this, however. First, it might take forever to figure out the number of meters that the car would need to move backwards. Second, this code only would work for one building. You would need to make one of these for each one of your buildings.
I haven't tried this out myself yet, so you should test it with the first building before you go and write all of your code. Good luck!
P.S.- One way that you might be able to check for a certain point crossed is to put a large invisible circle across the finish line, that way you could check for something to hit that point to win or whatever. If you just have something that says 'You Win', you could easily just make that become visible when the car hits that spot. Just make the sign start on the screen and vehicle it to the camera.
|