neilmmm
01-24-2006, 11:38 AM
I have made a little game where the user clicks on a movieclip and it randomly jumps around the stage - after 5 clicks i wanted it to go to a new screeen. I used a var called count - and had count ++ on the function and if statement comparing the value of count to 5.
But it does not work - I must be doing something fundamentally wrong can anyone help?
Neil
this is the actionscript and posted the fla:
stop();
var count = 0;
var missed:Sound = new Sound(this);
missed.attachSound("missed");
var heartbeat:Sound = new Sound(this);
heartbeat.attachSound("heartbeat");
heartbeat.start(0, 200);
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
return randomNum;
}
housepoint_mc.onPress = function() {
this._x = randRange(70, 480);
this._y = randRange(70, 330);
count ++;
missed.start(0, 1);
};
if (count == 5) {
gotoAndStop("fail");
}
But it does not work - I must be doing something fundamentally wrong can anyone help?
Neil
this is the actionscript and posted the fla:
stop();
var count = 0;
var missed:Sound = new Sound(this);
missed.attachSound("missed");
var heartbeat:Sound = new Sound(this);
heartbeat.attachSound("heartbeat");
heartbeat.start(0, 200);
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min;
return randomNum;
}
housepoint_mc.onPress = function() {
this._x = randRange(70, 480);
this._y = randRange(70, 330);
count ++;
missed.start(0, 1);
};
if (count == 5) {
gotoAndStop("fail");
}