I want the basket the fox is carrying to glow when an object goes into the basket. A good glow for the good object and a bad glow for the bad object. What is the best way to go about program this. Below is the scripting in AS 1.
THANKS
stop();
backgroundSound.start();
function initGame() {
// the range of falling apple clips
firstApple = 1;
lastApple = 0;
// init the score
score = 0;
// set the number of apples to fall
totalApples = 25;
// init the speed and time delay
timeSinceLastApple = 0;
appleSpeed = 5;
// create the fox so that it is on top of the apples
attachMovie("running fox","fox",999999);
fox._x = 275;
fox._y = 350;
}
function moveFox() {
// check for arrow keys
if (Key.isDown(Key.RIGHT)) {
dx = 10;
// fox faces right
fox._xscale = -Math.abs(fox._xscale);
} else if (Key.isDown(Key.LEFT)) {
dx = -10;
// fox faces left
fox._xscale = Math.abs(fox._xscale);
} else {
// no movement
dx = 0;
}
// move the fox and limit that movement
fox._x += dx;
if (fox._x<30) {
fox._x = 30;
}
if (fox._x>520) {
fox._x = 520;
}
// make the fox run or stand still
if ((dx != 0) and (fox._currentFrame == 1)) {
fox.gotoAndPlay("run");
} else if ((dx == 0) and (fox._currentFrame != 1)) {
fox.gotoAndPlay("stand");
}
}
function dropNewApple() {
// only drop if it has been long enough
if (timeSinceLastApple>20) {
// only drop if there are more apples
if (lastApple<totalApples) {
// only drop 10% of the time
if (Math.random()<.1) {
// create next apple and set its locations
lastApple++;
if (Math.random()<.5) {
// 50% chance of a bad apple
attachMovie("bad apple","apple"+lastApple,lastApple);
_root["apple"+lastApple].type = "bad";
} else {
// 50% chance of a good apple
attachMovie("good apple","apple"+lastApple,lastApple);
_root["apple"+lastApple].type = "good";
}
f = int(Math.Random()*_root["apple"+lastApple]._totalFrames)+1;
_root["apple"+lastApple].gotoAndStop(f);
_root["apple"+lastApple]._x = Math.random()*490+30;
_root["apple"+lastApple]._y = 0;
// reset time delay for next apple
timeSinceLastApple = 0;
// increase apple speed
if (appleSpeed<10) {
appleSpeed += .5;
}
}
}
}
// even if no apple dropped, get closer to next drop
timeSinceLastApple++;
}
function moveApples() {
// loop through all existing apple clips
for (i=firstApple; i<=lastApple; i++) {
// get apple location
x = _root["apple"+i]._x;
y = _root["apple"+i]._y+appleSpeed;
// see whether apple reached ground
if (y>400) {
removeApple(i);
// see whether apple hit basket
} else if ((Math.abs(y-fox._y)<10) and (Math.abs(x-fox._x)<25)) {
if (_root["apple"+i].type == "good") {
goodSound.start();
// good apple, get a point;
score += 5;
} else {
badSound.start();
// bad apple, lose a point
score -= 5;
// don't go below 0
if (score<0) {
score -= 0;
}
}
removeApple(i);
// continue to move apple
} else {
_root["apple"+i]._y = y;
}
}
}
function removeApple(n) {
// take away apple movie clip
_root["apple"+n].removeMovieClip();
// reset range of apples to move
firstApple = n+1;
// see whether this was the last apple
if (n == totalApples) {
fox.removeMovieClip();
gotoAndPlay("game over");
}
}