bataglia
07-17-2007, 04:41 PM
Hello everybody and thank you for your time. I build a simple game (you can check here (http://www.alienstudio.eu/game) to make you a better idea about). So, with few words, you must put each animal from right to left on his specific word. Everything it's ok, when I release an animal on his word the score will grow up with 100 points. When I try to release the animal on a wrong word then I want to loose points. In present I only can make the script when release on any area to loose points not only when I release on a wrong word. Here is what I use:
on (press) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
on (release) {
stopDrag();
name = this._name;
int_name = name.substring(1);
int_name = parseInt(int_name);
if (eval(this._droptarget) == _parent["inv_p"+int_name]) {
_parent.joined_mc["p"+int_name]._visible = true;
this._visible = false;
_root.score = _root.score + 100;
_parent.success++;
if (_parent.success == _parent.n) {
_root.gotoAndPlay("finish");
}
} else {
this._x = _parent.p1x;
this._y = _parent.p1y;
_root.score = _root.score -50;
}
}
Thank you for any help.
on (press) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
on (release) {
stopDrag();
name = this._name;
int_name = name.substring(1);
int_name = parseInt(int_name);
if (eval(this._droptarget) == _parent["inv_p"+int_name]) {
_parent.joined_mc["p"+int_name]._visible = true;
this._visible = false;
_root.score = _root.score + 100;
_parent.success++;
if (_parent.success == _parent.n) {
_root.gotoAndPlay("finish");
}
} else {
this._x = _parent.p1x;
this._y = _parent.p1y;
_root.score = _root.score -50;
}
}
Thank you for any help.