Trouble with an escape the room game.
This part that I'm working on consists of trading a hobo some twine for his alcohol. I'm trying to get the twine to disappear with dropped on the hobo, as well as the alcohol he is holding, which makes the twine leave my inventory and replaces it with the alcohol. So for I can get the twine to disappear correctly, but the alcohol can appear and disappear in some instances when I don't want them to.
here's the code on the twine in the inventory
onClipEvent (load) {
this.tabEnabled = false;
this._visible = false;
orig_x = this._x;
orig_y = this._y;
}
on (press) {
this.startDrag();
}
on (release) {
this.stopDrag();
if (eval(this._droptarget) == this._parent.hobo.hobogive) {
_global.hobobooze = 1
_global.alcohol = 1
this._visible = false;
this._root.inv_alcohol._visible = true;}
}
on (release) {
this.stopDrag();
this._x = orig_x;
this._y = orig_y;
if (eval(this._droptarget) == undefined)
this._visible = true;
this._root.inv_alcohol._visible = false;
//if i don't have the last line then
//the alcohol appears no matter where i drag the twine
}
What i have for the alcohol in the inventory
onClipEvent (load) {
this.tabEnabled = false;
this._visible = false;
}
and what is on the alcohol the hobo is holding
onClipEvent (load) {
this.tabEnabled = false;
if (_global.hobobooze == 0)
{this._visible = true;
}
if (_global.hobobooze == 1)
{this._visible = false;
}
}