| functions and variables
//starts movie with actor at stopped postion
_root.animation.buddy.gotoAndPlay("jump");
//sets variables to control the skyline's position
var n_count = skyline._x;
var o_count = skyline._x;
//moves the skyline
function moveSkyline(n_count, speed) {
skyline.onEnterFrame = function() {
n_count -= speed;
if (n_count<skyline._width*-1) {
n_count = o_count;
}
skyline._x = n_count;
};
}
//attaches and plays boombox when called
function boomBox() {
attachMovie("boomBox", "boom", 1);
boom._x= 450;
boom._y= 400;
}
//attaches and plays cow when called
function mooCow() {
attachMovie("cow", "moo", 1);
moo._x= 500;
moo._y= 400;
}
//attaches and plays jumping ball when called
function bounce() {
attachMovie("wheel", "round", 1);
round._x= 450;
round._y= 400;
}
//attaches and plays the wave when called
function bigWave() {
attachMovie("wave", "wave1", 1);
wave1._x= 100;
wave1._y= 425;
}
//resets movie clips
function remove() {
wave1.removeMovieClip();
round.removeMovieClip();
moo.removeMovieClip();
boom.removeMovieClip();
}
buttons
//starts boombox and tapping animation
on(keyPress "<up>") {
_root.remove();
_root.animation.gotoAndStop("tapping");
_root.moveSkyline(skyline._x, 0);
_root.boomBox();
}
//starts wave and running animation
on (keyPress "<right>") {
_root.remove();
_root.animation.gotoAndStop("running");
_root.moveSkyline(skyline._x, 15);
_root.bigWave();
}
//starts ball bounce and standing animation
on (keyPress "<down>") {
_root.remove();
_root.animation.gotoAndStop("standing");
_root.moveSkyline(skyline._x, 0);
_root.bounce();
}
//starts walking animation
on (keyPress "<left>") {
_root.remove();
_root.animation.gotoAndStop("walking");
_root.moveSkyline(skyline._x, 5);
}
//starts cow and scratching animation
on (keyPress "<space>") {
_root.remove();
_root.animation.gotoAndStop("scratching");
_root.moveSkyline(skyline._x, 0);
_root.mooCow();
}
|