Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread
Sponsored Links
Old 27-11-2009, 06:12 PM   #1
 
Jonny_5's Avatar
 
Join Date: Nov 2009
Posts: 4
uk
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0 Jonny_5 is an unknown quantity at this point
Angry Flash Collision Detection?

Basically i have my little car goin around but if it hits the sides it doesnt do anything i want it to move to another keyframe. If anyone flash experts know the codes then please help meee!!

Thankz:P
  Reply With Quote
Old 27-11-2009, 06:54 PM   #2
 
localzuk's Avatar
 
Join Date: Dec 2006
Location: Minehead, Somerset
Posts: 6,636
isle of man uk isle of man
Thanks: 180
Thanked 490 Times in 400 Posts
Blog Entries: 14
Rep Power: 135 localzuk ooh
localzuk ooh localzuk ooh localzuk ooh localzuk ooh localzuk ooh
Send a message via MSN to localzuk Send a message via Yahoo to localzuk Send a message via Skype™ to localzuk
Default

I'm not particularly a flash expert, but collision detection is pretty much the same whatever language. You need some form of script to monitor the objects, and see when their boundaries cross/touch.

This video may help:

  Reply With Quote
Thanks to localzuk from:
Jonny_5 (28-11-2009)
Old 29-11-2009, 05:44 PM   #3
 
stuj1's Avatar
 
Join Date: Nov 2009
Location: Gloucestershire
Posts: 3
uk uk england
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 stuj1 is an unknown quantity at this point
Default

is it as2 or as3?
When you move the car you want to get it's x and y position. Then use an if statement so that:

if(car.x < 0) {
// hit the left wall
} else if(car.x > Stage.width) {
// hit the right wall
}
if(car.y < 0) {
// hit the ceiling
} else if(car.y > Stage.height) {
// hit the floor
}

You can adjust the values to take into account the car's width by using this instead:

if(car.x-(car.width/2) < 0)


Failing that use the hitTest method, placing movieclips around the outside. Check the Flash help for hitTest
  Reply With Quote
Old 29-11-2009, 06:14 PM   #4
 
Jonny_5's Avatar
 
Join Date: Nov 2009
Posts: 4
uk
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0 Jonny_5 is an unknown quantity at this point
Default

its as3 but thnx for the tips (:
  Reply With Quote
Old 30-11-2009, 12:26 PM   #5
 
StewartKnight's Avatar
 
Join Date: Jun 2005
Posts: 1,625
uk
Thanks: 2
Thanked 20 Times in 16 Posts
Rep Power: 20 StewartKnight has a spectacular aura about StewartKnight has a spectacular aura about StewartKnight has a spectacular aura about
Default

you need the hittest i.e.

if (car.hitTest(line1)) {
gotoAndStop(2);
}
if (car.hitTest(end)) {
gotoAndStop(4);
}
};


Instead of goto and stop, you could have nextFrame

Send me your email address, and I'll email you some working code as a demonstration!
  Reply With Quote
Thanks to StewartKnight from:
Jonny_5 (30-11-2009)
Old 30-11-2009, 06:50 PM   #6
 
Jonny_5's Avatar
 
Join Date: Nov 2009
Posts: 4
uk
Thanks: 3
Thanked 0 Times in 0 Posts
Rep Power: 0 Jonny_5 is an unknown quantity at this point
Default

my email adress is jonnyebr@hotmail.com
thnx alot
  Reply With Quote
Reply

EduGeek.net Forums > Coding and Web Development > Coding

Similar Threads
Thread Thread Starter Forum Replies Last Post
plagiarism detection PEO General Chat 9 08-01-2010 12:50 AM
HP Procurve High collision or drop rate errors techie08 Networks 1 12-03-2009 12:37 AM
AP's with rogue AP detection Jobos Networks 1 02-03-2009 07:20 PM
Hardware Detection Mr.Ben Windows 1 20-05-2008 10:08 PM
Detection of flash within browser regardless of .. mac_shinobi Web Development 3 31-08-2005 03:32 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:16 PM.
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright EduGeek.net




website uptime

© 2005 - 2009 EduGeek.net
SERVER: 4
no new posts