Wednesday, 1 April 2015

Daniel Goodbry Tutorial: 1st April 2015

Today I had a tutorial with Daniel Goodbry regarding the coding for my project.

I wanted to know how I could trigger an animation when it was on a certain part of the screen. With Daniels help we manged to code an example that I could then re-create within my own project.

Code used:
addEventListener(Event.ENTER_FRAME, checkHit);

function checkHit (e:Event):void{

if (scroll.anim1.hitTestObject(hitChecker)){
scroll.anim1.play();
}
if (scroll.anim2.hitTestObject(hitChecker)){
scroll.anim2.play();
}
}

Tutorial Example:
Use the arrow keys to move the boxes.
The red boxes animate when they are moved across the blue line.