I wrote a function for picking up an object a while ago, which worked fine. I've recently added another animation, and now it doesn't.
HOWEVER, if I turn off or delete code for the animation I've added, it still does it.
Here's my code:
Code: ags
in GlobalScript.asc:
Code: ags
Firstly, I have tried this with and without UnlockView().
For the code:
-first, julius walks to a predefined position for hStick, a hotspot.
-then he faces the stick
-he say's something ("It's my friend - mr sticky-stick.")
-it goes into the function pickup - this is a low pickup, to the right, so:
LockView(50);
Animate(2, 0, eOnce, eBlock);
-the animation is supposed to happen - IT DOESN'T
-inventory item is added, object is set to invisible
-view is Unlocked (or not, when I comment it out, makes no difference anyway)
-the HotSpot for this object, hStick, is switched off
Here's a video:
video
yes, I have tried plotting out the course of the code with breakpoints, this appears to be the only way.
Why, oh god why, is it not animating?
HOWEVER, if I turn off or delete code for the animation I've added, it still does it.
Here's my code:
function hStick_Interact()
{
cJulius.FaceObject(oStick);
cJulius.SayBubble("&244 It's my friend - mr sticky-stick.");
cJulius.PickUp(eLow, iStick, oStick);
hStick.Enabled=false;
}
in GlobalScript.asc:
function PickUp (this Character*, PickUpHeight height, InventoryItem *i, Object *o, bool visibility)
{
int loop=0;
int _height=0;
if (height == eLow) {
_height=50; //low animation
}
if (height == eHigh) {
_height=49; //high animation
}
if (this.x <= o.X) {
loop=2; //right
} else {
loop=1; //left
}
this.LockView(_height);
this.Animate(loop, 0, eOnce, eBlock);
this.AddInventory(i, 0);
o.Visible = visibility;
this.UnlockView();
}
Firstly, I have tried this with and without UnlockView().
For the code:
-first, julius walks to a predefined position for hStick, a hotspot.
-then he faces the stick
-he say's something ("It's my friend - mr sticky-stick.")
-it goes into the function pickup - this is a low pickup, to the right, so:
LockView(50);
Animate(2, 0, eOnce, eBlock);
-the animation is supposed to happen - IT DOESN'T
-inventory item is added, object is set to invisible
-view is Unlocked (or not, when I comment it out, makes no difference anyway)
-the HotSpot for this object, hStick, is switched off
Here's a video:
video
yes, I have tried plotting out the course of the code with breakpoints, this appears to be the only way.
Why, oh god why, is it not animating?