Monday 23 January 2012

Collision Detection - Hit Test in Flash

1) Make 2 layers. One named AS and one called circles. On the layer named circles draw 2 circles of different colours. Convert both to symbols --> movie clips.

2)Name one circle circle1 and the other circle2.

3)On the AS layer, hit F9 to do some coding.

This means you can drag Circle1 around. To be able to drag circle2 copy and paste the coding, changing 1 to 2. To check these work hit Ctrl + Enter to preview it.

4) After the above coding. Write this. This is for the Hit Test.

5) Add a new layer called page 2. Add a keyframe into the 2nd frame and write a 2 on it. Make sure the other layers are only 1 frame long. Now to make the jump to the 2nd page when you drag one of the circles over the other circle you need to add some more coding.

Now you should go from a page with 2 circles to a page with a number 2 when you drag and drop one of the 2 circles over the other one.

No comments:

Post a Comment