Kamil Tomaszewski
Kamil Tomaszewski

Reputation: 3

How to create car collision in AS3?

I have a background with a top view motorway and forest on the sides and I want it so that when the car touches the green forest area the game changes to another scene. I have tried to put a line on the forest area and make it so that if the car hits the line switch to another scene but I have failed. I'm using action scrip 3. Thanks.

Upvotes: 0

Views: 94

Answers (1)

Cadin
Cadin

Reputation: 4649

One solution might be to put the track pavement graphic in a separate sprite that sits on top of the green forest. Then you can hit test to see when your car is not touching the road. That would mean it's in the forest.

There's a simple top-down racing game in this book that uses a similar technique: AS3 Game Programming University (site)

Taking a look at that book might be really helpful if you are just starting out with games.

Upvotes: 1

Related Questions