Getting an object to move by interacting with hotspot (SOLVED)

Started by jfarwyke, Fri 12/02/2010 14:27:37

Previous topic - Next topic

jfarwyke

Basically, after the player interacts with a hotspot, I have animations that perform perfectly, until an object is supposed to move, then my game freezes. Also, when I was typing the script command: oFrame, it gave me a choice of "oFrame_Interact" and when I typed the period, it automatically put in "oFrame_Interact" and I don't know why, but that may have something to do with the problem. Here is my code...

Code: ags

function hImpact_Interact()
{
cPup.Walk(397, 349, eBlock);
cPup.FaceLocation(373, 212, eBlock);
Wait(10);
cPup.SetWalkSpeed(20, 20);
cPup.AnimationSpeed = 1;
cPup.Walk(374, 255, eBlock);
PlaySound(5);
cPup.SetWalkSpeed(6, 6);
cPup.AnimationSpeed = 4;
cPup.Move(376, 265, eBlock);
oFrame.Move(358, 161, 1, eBlock);
}


It's probably something simple I'm not seeing. I'm returning to AGS after a hiatus and maybe I've forgotten a few things. I've already consulted the manual and did a search on the forums and have not came up on a solution. Anyone got any ideas? Much appreciated.

Crimson Wizard

#1
I don't see your room, so I can only guess, but -
AFAIK, Move requires moving along walkable areas by default.
Try this instead:

Code: ags

oFrame.Move(358, 161, 1, eBlock, eAnywhere);



EDIT: Hmm, on second thought even if that was the problem it shouldn't freeze the game...


Khris


Crimson Wizard

Quote from: Khris on Fri 12/02/2010 15:51:15
It could, it's a blocking move.
Yes, but aren't Move function make object/character stop when it can't come any closer to destination because of missing walkable area?

jfarwyke

Well I tried the eAnywhere, and this time it crashes with the following message:
Error: Object.Move: Invalid BLOCKING parameter

Code: ags

function hImpact_Interact()
{
cPup.Walk(397, 349, eBlock);
cPup.FaceLocation(373, 212, eBlock);
Wait(10);
cPup.SetWalkSpeed(20, 20);
cPup.AnimationSpeed = 1;
cPup.Walk(374, 255, eBlock);
PlaySound(5);
cPup.SetWalkSpeed(6, 6);
cPup.AnimationSpeed = 4;
cPup.Move(376, 265, eBlock);
oFrame.Move(158, 161, eBlock, eAnywhere);
}


When I leave the blocking out, it neither crashes or freezes, but my object doesn't move. What concerns me is that when I begin typing oFrame as a command, it is not usually listed in the pop-up list, but oFrame_Interact is. However sometimes oFrame is listed even though I don't do anything different. I've already made sure that oFrame is labeled correctly.

EDIT:

Okay, I went ahead and deleted the oFrame.Move command, deleted the oFrame_Interact function, re-typed the oFrame.Move command, then reapplied the oFrame_Interact function. Now everything looks exactly the same, except it works fine. All the interact function had under it was a walk-to and a display message but for some reason it was the source of the problem, not sure how though. But anyway, now it works.

Matti

You forgot to set the speed parameter:

oFrame.Move(158, 161, 1, eBlock, eAnywhere);

jfarwyke

Good call. First I forgot the eAnywhere, then when I got that, I forgot the speed. I knew it was a simple eff-up on my part. Thanks everyone.

Khris

The auto-complete window should show which parameters you're supposed to enter. (and in which order).

SMF spam blocked by CleanTalk