Wednesday, 18 May 2011

Animating a dot

Today what we have done is grab a dot and animate it, we have made a clip on flash by increasing the size and putting it on repeat, also with combining it with script, we made it repeat.


Also another thing we have done is added a score system with coding, what we have done is made a text box and added some codes to make whenever you click on the dot, the score increases by one.


var score:Number=0
scoreText.text="SCORE  "+String(score)


dot.addEventListener(MouseEvent.CLICK, bananas);


function bananas(event:MouseEvent):void
{
score+=1
scoreText.text="SCORE  "+String(score)
trace("SCORE")
}

Thats the script I have currently used, dot is the object with addEventListener gives it the command while the MouseEvent Click is how to work the code, bananas is there so the whole line follows on to where bananas is used again which means it will have to follow everything else thats listed.
















Here in this screenshot I am showing that i have the dot and a text box, you cannot type in the box in action script 3 as it messes up.





In this screenshot I have readied the clip and coded it so the score appears as soon as you start.













As you click on the dot, the score steadily increases by one with each click.







No comments:

Post a Comment