Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: MovieGuy13 on Mon 27/04/2009 14:13:00

Title: Moving player to object
Post by: MovieGuy13 on Mon 27/04/2009 14:13:00
I know this will sound stupid, but how do you move a character to an object(not hotspot) when you interact with it?  I haven't used AGS in a while and the knowledge base doesn't work for me(don't know why). So please!
Title: Re: Moving player to object
Post by: Khris on Mon 27/04/2009 14:17:18
  player.Walk(147, 120, eBlock);

You could use the object's coords and width to make him automatically approach the object, too.

And please read the manual.
Title: Re: Moving player to object
Post by: MovieGuy13 on Mon 27/04/2009 14:21:43
Quote from: KhrisMUC on Mon 27/04/2009 14:17:18
  player.Walk(147, 120, eBlock);

You could use the object's coords and width to make him automatically approach the object, too.

And please read the manual.

I did this and it tells me it expects "[".
Sorry for not reading the manual, I couldn't find that topic in it, but will search more
Title: Re: Moving player to object
Post by: Gilbert on Mon 27/04/2009 14:33:15
For the [ problem, did you use the word object, or character, in your script line? They are arrays, so you have to provide an index in brackets.
For example, if you want the player approaches object 4 in the room you have to write:

player.Walk(object[4].X, object[4].Y, eBlock);