i’m making a catch game such as can be found at http://www.mathplayground.com/multiples.html
the code i’m using right now has drop1 falling as i want it to, and drop2 does appear, but it will not repeat, as the coding suggests it should. is there a way to put the newClip in one section, or link it together, so that both drop1 and drop2 will continue to fall, at the same interval.
here is the coding i’m using
StageWidth = 550;
StageHeight = 400;
var num:Number;
function moveStuff() {
if (Key.isDown(Key.LEFT)) {
this._x -= this.speed;
}
if (Key.isDown(Key.RIGHT)) {
this._x += this.speed;
}
if (this._x>StageWidth+(this._width/2)) {
this._x = 0-(this._width/2);
}
if (this._x<0-(this._width/2)) {
this._x = StageWidth+(this._width/2);
}
if (this._y>StageHeight+(this._height/2)) {
this._y = 0-(this._height/2);
}
if (this._y<0-(this._height/2)) {
this._y = StageHeight+(this._height/2);
}
}
girl_mc.speed = 13;
girl_mc.onEnterFrame = moveStuff;
watchKeyBoard = new Object();
watchKeyBoard.onKeyDown = function() {
trace("a key is pressed. the key that is pressed is "+Key.getAscii());
};
Key.addListener(watchKeyBoard);
/*found at http://www.swinburne.edu.au/design/tutorials/P-flash/T-Actionscripting-for-games/ID-41/#five*/
depth = 0;
function makeNewClip() {
clearInterval(ranID)
ranID=setInterval(makeNewClip, ran)
newClip = _root.attachMovie('drop1', 'drop1'+depth, depth++);
newClip._x = Math.random()*490;
newClip._y = -40;
newClip.speed = 3;
newClip.onEnterFrame = function() {
this._y += this.speed;
};
}
makeNewClip();
setInterval(makeNewClip,5000);
depth = 0;
clearInterval(ranID)
ranID=setInterval(makeNewClip, ran)
newClip = _root.attachMovie('drop2', 'drop2'+depth, depth++);
newClip._x = Math.random()*490;
newClip._y = -40;
newClip.speed = 3;
newClip.onEnterFrame = function() {
this._y += this.speed;
};
i need to get drop2 to repeat, and after that i will be adding in a drop3, drop4, drop5, drop6, drop7 etc so that there is a whole lot falling down from the top of the screen.
any help will be greatly appreciated!!!
this is a project due day after tomorrow.
thanks =S