HOME | DD

John-Boyer — Collision Avoidance WIP 1 by-nc-sa

Published: 2011-10-22 18:31:55 +0000 UTC; Views: 1227; Favourites: 8; Downloads: 16
Redirect to original
Description I finally uploaded something in Flash!
Well... this was a blast to make. I've wanted to do this ever since I first started, but never figured it out. Well, here it is.
The little evil spark plugs wander around, avoiding collisions. Lots of math involved.

This engine will work really well for racing games, as you can see by that racetrack thing in the middle...


Ok. Controls. Click to spawn little bug thingies, and hit the spacebar to remove them all. That's it!

Yes, I will give you the code if you note me. It's heavily commented, although slightly mispelled, in English, cause that's the only language I know. Actionscript 3, with flash CS4 or above. I might make a pure Actionscript version, like Flash Builder or FlashDevelop, but... too lazy right now.

[EDIT]
I added a counter, so you can see how many thingies there are.
[END EDIT]


Tools: Flash CS5.5
Work Time: about 2 hours...

Let the continuous commenting commence!
Related content
Comments: 19

AgrizzleBear [2012-01-28 02:53:20 +0000 UTC]

hours of endless entertainment, thanks

👍: 0 ⏩: 1

John-Boyer In reply to AgrizzleBear [2012-01-28 15:31:29 +0000 UTC]

👍: 0 ⏩: 0

Schweinskopfsuelze [2011-10-29 11:39:41 +0000 UTC]

Sometimes, clicking causes the spawn thing to fly away (out of the screen)

I guess this could be interesting:
[link]

👍: 0 ⏩: 1

John-Boyer In reply to Schweinskopfsuelze [2011-10-29 22:40:22 +0000 UTC]

Thanks for the link, looks interesting.
Yes... if the thingumabob backs into something, it immediatly accelerates... unfortunately, it accelerates backwards, farther into the object, going faster and faster until... it shoots off the screen.
I'm sure there's a way to fix it, but... too lazy. Maybe in the next version...

👍: 0 ⏩: 0

Seaworm [2011-10-26 19:38:57 +0000 UTC]

You should include a counter for the amount of spark plugs on the field
I clicked until it started going really slow; but I couldn't count all the plugs :<

👍: 0 ⏩: 1

John-Boyer In reply to Seaworm [2011-10-27 20:08:30 +0000 UTC]

Done!
I can get to 50, then it starts to lag.

👍: 0 ⏩: 0

dhigo31 [2011-10-25 09:00:48 +0000 UTC]

woah this is awesome! :fav:
btw, i would really like to know this code

👍: 0 ⏩: 1

John-Boyer In reply to dhigo31 [2011-10-25 13:25:10 +0000 UTC]

Glad you like it!
Here's the source code: [link]
If you have any questions... just ask. Enjoy!

👍: 0 ⏩: 1

dhigo31 In reply to John-Boyer [2011-10-25 13:36:20 +0000 UTC]

woah, thank you very much for it

👍: 0 ⏩: 1

John-Boyer In reply to dhigo31 [2011-10-25 13:37:27 +0000 UTC]

np. I really just did it to figure out how, so why keep it to myself?

👍: 0 ⏩: 1

dhigo31 In reply to John-Boyer [2011-10-25 13:46:20 +0000 UTC]

yeah

👍: 0 ⏩: 0

pettankon [2011-10-24 19:35:38 +0000 UTC]

It's a neat take on collision avoidance. I assume it doesn't predict anything but is completely responsive. When a certain distance from the wall turn based on the angle it would go into the collision at.

What about extremely tight spaces and hitting the wall straight on? Are there things in place to account for that?

👍: 0 ⏩: 1

John-Boyer In reply to pettankon [2011-10-24 20:40:01 +0000 UTC]

Nope, completely responsive.
Hitting the wall straight on triggers a reduction of speed. The closer to straight on and the harder it hits, the more the speed is reduced, which is why it bounces backwards.
Tight spaces... not so much. I wasn't sure how to solve that problem...

👍: 0 ⏩: 0

viewtifulday [2011-10-23 21:24:49 +0000 UTC]

This is pretty sick!

👍: 0 ⏩: 1

John-Boyer In reply to viewtifulday [2011-10-23 22:13:34 +0000 UTC]

👍: 0 ⏩: 0

1deathgod [2011-10-22 19:33:50 +0000 UTC]

Ummmm . . . What exactly is this?

👍: 0 ⏩: 1

John-Boyer In reply to 1deathgod [2011-10-22 21:27:51 +0000 UTC]

A flash program... not exactly art.

👍: 0 ⏩: 1

1deathgod In reply to John-Boyer [2011-10-22 21:32:53 +0000 UTC]

Okay, I have no idea what that means.

👍: 0 ⏩: 1

John-Boyer In reply to 1deathgod [2011-10-22 21:46:49 +0000 UTC]

k.

👍: 0 ⏩: 0