Combined Code
frame 1 {
authortext = 'All Flash programming by Dean Alexandrou, Marc Schröder, & John Hart';
companytext = 'Creative IT Systems Ltd. creativeit.com';
}
button 47 {
on (keyPress 'z') {
dancecounter = '0';
if (catcherhasanvil == '0') {
catchervx -= '20';
if (catchervx < '0' - '35') {
catchervx = '0' - '35';
} else {
tellTarget ('/catcher') {
gotoAndPlay('sidestep');
}
}
}
}
on (keyPress 'Z') {
dancecounter = '0';
if (catcherhasanvil == '0') {
catchervx -= '20';
if (catchervx < '0' - '35') {
catchervx = '0' - '35';
} else {
tellTarget ('/catcher') {
gotoAndPlay('sidestep');
}
}
}
}
on (keyPress 'x') {
dancecounter = '0';
if (catcherhasanvil == '0') {
catchervx += '20';
if ('35' < catchervx) {
catchervx = '35';
} else {
tellTarget ('/catcher') {
gotoAndPlay('sidestep');
}
}
}
}
on (keyPress 'X') {
dancecounter = '0';
if (catcherhasanvil == '0') {
catchervx += '20';
if ('35' < catchervx) {
catchervx = '35';
} else {
tellTarget ('/catcher') {
gotoAndPlay('sidestep');
}
}
}
}
on (keyPress '<Space>') {
dancecounter = '0';
if (catcherhasanvil == '0') {
catcherthrow = '1';
}
}
}
frame 2 {
stop();
}
button 52 {
on (release) {
gotoAndPlay(3);
}
}
frame 3 {
catchersx = '380';
catchersy = '360';
catchervx = '0';
catchervy = '0';
catcherhasproduct = '0';
catcherhasanvil = '0';
catcherthrow = '0';
/catcher._x = catchersx;
/catcher._y = catchersy;
tellTarget ('/catcher') {
gotoAndPlay('mainloop');
}
productnum = '4';
N = '1';
while (productnum >= N) {
eval('product' add N add 'sx') = '0' - '100';
eval('product' add N add 'sy') = '0' - '100';
eval('product' add N add 'vy') = '0';
eval('product' add N add 'state') = '0';
eval('/product' add N)._x = eval('product' add N add 'sx');
eval('/product' add N)._y = eval('product' add N add 'sy');
N += '1';
}
anvilsx = '0' - '100';
anvilsy = '0' - '100';
anvilstate = '0';
/anvil._x = anvilsx;
/anvil._y = anvilsy;
trolleysx = '620';
trolleysy = '380';
trolleyhasproduct = '0';
/trolley._x = trolleysx;
/trolley._y = trolleysy;
collecteditems = '0';
droppeditems = '0';
N = '1';
while ('10' >= N) {
removeMovieClip('collecteditem' add N);
removeMovieClip('droppeditem' add N);
N += '1';
}
dancecounter = '0';
}
frame 4 {
if (catchersx < '160') {
catchersx = '160';
if (catchervx < '0') {
catchervx = '0';
}
}
if ('600' < catchersx) {
catchersx = '600';
if ('0' < catchervx) {
catchervx = '0';
}
}
if ('1' < catchervx * catchervx) {
catchersx += catchervx;
catchervx *= '0.85';
} else {
catchervx = '0';
}
if (catcherthrow == '1') {
catcherthrow = '0';
tellTarget ('/catcher') {
gotoAndPlay('throw');
}
if ('0' < catcherhasproduct) {
eval('product' add catcherhasproduct add 'vx') = (trolleysx - catchersx) / '18';
eval('product' add catcherhasproduct add 'vy') = '0' - '20';
eval('product' add catcherhasproduct add 'state') = '0' - '2';
catcherhasproduct = '0';
}
}
N = '1';
while (productnum >= N) {
productNstate = eval('product' add N add 'state');
if (productNstate == '0') {
if (random('50' - collecteditems) == '1') {
eval('product' add N add 'sx') = random('420') + '160';
eval('product' add N add 'sy') = '0' - '10';
eval('product' add N add 'vy') = random('7' + collecteditems) + '5' + collecteditems;
eval('product' add N add 'state') = '1';
tellTarget (''/product' add N') {
gotoAndStop(1);
}
}
} else {
if (productNstate == '1') {
eval('product' add N add 'sy') += eval('product' add N add 'vy');
if (catcherhasproduct == '0' and catcherhasanvil == '0') {
if (catchersy - '85' >= eval('product' add N add 'sy') and eval('product' add N add 'sy') >= catchersy - '120' and eval('product' add N add 'sx') >= catchersx - '35' and catchersx + '35' >= eval('product' add N add 'sx')) {
eval('product' add N add 'sx') = catchersx;
eval('product' add N add 'sy') = catchersy - '112';
eval('product' add N add 'state') = '0' - '1';
catcherhasproduct = N;
}
}
if (eval('product' add N add 'sy') >= '370') {
eval('product' add N add 'sy') = '370';
eval('product' add N add 'state') = '2';
tellTarget (''/product' add N') {
gotoAndStop(2);
}
}
} else {
if (productNstate >= '2') {
if (productNstate >= '10') {
eval('product' add N add 'sx') = '0' - '100';
eval('product' add N add 'sy') = '0' - '100';
eval('product' add N add 'state') = '0';
droppeditems += '1';
duplicateMovieClip('/sm_b_product' add N, 'droppeditem' add droppeditems, 16384);
eval('droppeditem' add droppeditems)._x = '50';
eval('droppeditem' add droppeditems)._y = '380' - droppeditems * '32';
if (droppeditems >= '10') {
gotoAndPlay(7);
}
} else {
eval('product' add N add 'state') += '1';
}
} else {
if (productNstate == '0' - '1') {
eval('product' add N add 'sx') = catchersx;
eval('product' add N add 'sy') = catchersy - '112';
} else {
if (productNstate == '0' - '2') {
eval('product' add N add 'sx') += eval('product' add N add 'vx');
eval('product' add N add 'sy') += eval('product' add N add 'vy');
eval('product' add N add 'vy') += '3';
if (trolleyhasproduct == '0') {
if (trolleysy - '32' >= eval('product' add N add 'sy') and eval('product' add N add 'sy') >= trolleysy - '70' and eval('product' add N add 'sx') >= trolleysx - '40' and trolleysx + '40' >= eval('product' add N add 'sx')) {
eval('product' add N add 'sx') = trolleysx;
eval('product' add N add 'sy') = trolleysy - '41';
eval('product' add N add 'state') = '0' - '3';
trolleyhasproduct = N;
}
}
if (eval('product' add N add 'sy') >= '370') {
eval('product' add N add 'sy') = '370';
eval('product' add N add 'state') = '2';
tellTarget (''/product' add N') {
gotoAndStop(2);
}
}
} else {
if (productNstate == '0' - '3') {
eval('product' add N add 'sx') = trolleysx;
eval('product' add N add 'sy') = trolleysy - '41';
}
}
}
}
}
}
N += '1';
}
if (anvilstate == '0') {
if (random('100' - collecteditems * '4') == '1') {
anvilsx = random('420') + '160';
anvilsy = '0' - '10';
anvilstate = '1';
}
} else {
if (anvilstate == '1') {
anvilsy += '15';
if (catcherhasproduct == '0' and catcherhasanvil == '0') {
if (catchersy - '80' >= anvilsy and anvilsy >= catchersy - '113' and anvilsx >= catchersx - '35' and catchersx + '35' >= anvilsx) {
anvilsx = catchersx;
anvilsy = catchersy - '61';
anvilstate = '0' - '1';
catcherhasanvil = '1';
tellTarget ('/catcher') {
gotoAndPlay('anvil');
}
}
}
if (anvilsy >= '370') {
anvilsy = '370';
anvilstate = '2';
}
} else {
if (anvilstate >= '2') {
if (anvilstate >= '10') {
anvilsx = '0' - '100';
anvilsy = '0' - '100';
anvilstate = '0';
} else {
anvilstate += '1';
}
} else {
if (anvilstate == '0' - '1') {
anvilsx = catchersx;
anvilsy = catchersy - '61';
} else {
if (anvilstate == '0' - '2') {
anvilsy += '15';
if (anvilsy >= '370') {
anvilsy = '370';
anvilstate = '2';
}
}
}
}
}
}
if ('0' < trolleyhasproduct) {
trolleysx += '15';
if (trolleysx >= '760') {
eval('product' add trolleyhasproduct add 'state') = '0';
collecteditems += '1';
duplicateMovieClip('/sm_product' add trolleyhasproduct, 'collecteditem' add collecteditems, 16384);
eval('collecteditem' add collecteditems)._x = '710';
eval('collecteditem' add collecteditems)._y = '380' - collecteditems * '32';
if (collecteditems >= '10') {
gotoAndPlay(6);
}
trolleyhasproduct = '0';
}
} else {
if ('620' < trolleysx) {
trolleysx -= '15';
}
}
dancecounter += '1';
if ('0' < catcherhasanvil and dancecounter >= '99') {
dancecounter = '0';
tellTarget ('/catcher') {
gotoAndPlay('anvil');
}
}
if ('0' < catcherhasproduct and dancecounter >= '99') {
dancecounter = '0';
tellTarget ('/catcher') {
gotoAndPlay('mainloop');
}
}
if (dancecounter == '100') {
tellTarget ('/catcher') {
gotoAndPlay('dance');
}
}
}
frame 5 {
/catcher._x = catchersx;
/catcher._y = catchersy;
N = '1';
while (productnum >= N) {
eval('/product' add N)._x = eval('product' add N add 'sx');
eval('/product' add N)._y = eval('product' add N add 'sy');
N += '1';
}
/anvil._x = anvilsx;
/anvil._y = anvilsy;
/trolley._x = trolleysx;
/trolley._y = trolleysy;
gotoAndPlay(4);
}
frame 6 {
stop();
}
frame 6 {
stopAllSounds();
}
frame 7 {
stop();
}
frame 7 {
stopAllSounds();
}