Monday, 5 March 2007

"Hurt", "Sleep" and "Happiness-ometer"!

Today was extremely successful.

I created the animations for "hurt" and "sleep" and put actionscript on both these buttons telling flash to play the frame where the relevant animation is when clicked.

This is an example of the actionscript coding I used on the buttons:

on (release) {

gotoAndPlay(20);

}

For the "hurt" animation I made a key frame with a "foot" in and converted it to a movie clip. I then added another key frame in which the foot appears to be kicking the pet with the word "POW" flash up. I motion tweened these frames so that when the "hurt" button is pressed the panda appears to be kicked by the foot.

I did the same process for "sleep" but using a bed and some "zzz's".

I also created the "happiness-ometer" by putting a variable in:

var happy=10

This code makes the happiness level start at 10 (the middle). At the end of each movie clip I added:

if (happy <20)

happy=happy+2;

or

if (happy >0)

happy=happy-2;

depending on whether the movie clip makes Pebbles happy or sad.