Hi i have a couple of questions i hope you can answer please…
-
How do i add a countdown code to a scene and after 120 seconds it goes onto scene “score”
-
also on the score scene how can i make it show the score they got on the game in a dynamic text box
i have made the scoring system using this tutorial
http://www.kirupa.com/developer/mx/score.htm
-
how can i add a sound to a movie clip when it is pressed becuase i am using the random movement thing i found on this site… i have made it so it adds to the score when clicked how do i make it play a sound aswell when pressed
-
I am using this code for the random movement of a movie clip, however how can i alter the x and y position of the movie width and height???
i added the bits in green, but they don’t work. How am i supposed to do it???
// special thanks to Suprabeener for the code
function getdistance(x, y, x1, y1) {
var run, rise;
run = x1-x;
rise = y1-y;
return (_root.hyp(run, rise));
}
function hyp(a, b) {
return (Math.sqrt(a*a+b*b));
}
MovieClip.prototype.reset = function() {
// specify the width and height of the movie
width = 379;
height = 249;
[color=green]
x = 11
y = 41.1
[/color]
// -------------------
var dist, norm;
this.x = this._x;
this.y = this._y;
this.speed = 100;
this.targx = Math.random()*width;
this.targy = Math.random()*height;
dist = _root.getdistance(this.x, this.y, this.targx, this.targy);
norm = this.speed/dist;
this.diffx = (this.targx-this.x)*norm;
this.diffy = (this.targy-this.y)*norm;
};
MovieClip.prototype.move = function() {
if (_root.getdistance(this.x, this.y, this.targx, this.targy)>this.speed) {
this.x += this.diffx;
this.y += this.diffy;
} else {
this.x = this.targx;
this.y = this.targy;
if (!this.t) {
this.t = getTimer();
}
if (getTimer()-this.t>666.666) {
this.reset();
this.t = 0;
}
}
this._x = this.x;
this._y = this.y;
};
thank you