Collision Detection PowerPoint PPT Presentation

presentation player overlay
1 / 8
About This Presentation
Transcript and Presenter's Notes

Title: Collision Detection


1
Collision Detection
2
hitTest()
  • Gets sent a movie clip
  • Checks the movie clip it was called from and the
    movie clip it was sent for collisions
  • Returns a true or a false

3
if (square.hitTest(circle)) // something
important happens here
Returns true Something important happens
Returns false Nothing happens
4
Nothings Easy
  • Computers are not fast enough to calculate
    collisions between complex shapes
  • State of the art 3-d games use hitboxes
  • Square characters are boring

5
(No Transcript)
6
_root.guy.head_root.guy.leftHand_root.guy.rightH
and_root.guy.body_root.guy.leftFoot_root.guy.ri
ghtFoot
_root.guy
7
  • hitTest would be written in onClipEvent(enter)Fram
    e
  • 6 6 36
  • 6 6 46656

8
if (guy.hitTest(enemy)) if ((guy.head.hitTest(en
emy)) (guy.leftHand.hitTest(enemy))
(guy.rightHand.hitTest(enemy))
(guy.body.hitTest(enemy)) (guy.leftFoot.hi
tTest(enemy )) (guy.rightFoot.hitTest(enemy))
) // something important
Write a Comment
User Comments (0)
About PowerShow.com