Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: spook1 on Mon 21/11/2005 10:58:26

Title: trouble with character[name].moving
Post by: spook1 on Mon 21/11/2005 10:58:26
I want to set some characters at a start position when entering a  room.
(a hat on a main character). From there I intend to make the hat stay on the characters' head with FolloCharacterExactly.

I think I need to set everything in place before player enters room. I made a funtion

Initialize(string name, int xcoord, int ycoord){
if (character[Name].moving) StopMoving(Name);
Character[name].x = xcoord;
Character[name].y = ycoord;
}

But the code does not work (character[name].moving seems to be obsolete)
Does anyone know what to replace it by?

thanks in advance,
Martin
Title: Re: trouble with character[name].moving
Post by: Ashen on Mon 21/11/2005 11:06:56
Read the manual:
Quote
Moving property (character)
(Formerly known as character[].walking, which is now obsolete)

readonly bool Character.Moving

Returns 1 if the character is currently moving, or 0 if not.
This property is read-only; to change the character's movement, use the Walk and StopMoving commands.

It's not obsolete, just capitalised (Moving not moving). Also, if you haven't in the actual code, check the rest of your capitalisation - 'character' should be all lower case, and 'name' should be the same every time. (And 'name' should be an int, which you've obviously noticed - see later post.)
Title: Re: trouble with character[name].moving
Post by: Candle on Mon 21/11/2005 11:51:10
Why not make a char with the hat on and change to that view and the other view when he takes it off?
Title: Re: trouble with character[name].moving
Post by: spook1 on Mon 21/11/2005 11:52:11
thnx,

now another strage eeror:

function PlaatsDraden(int DraadID, int xcoord, int ycoord) {
if ( character[DraadID].Moving )  character[DraadID].StopMoving;
  character[DraadID].x = xcoord;
  character[DraadID].y = ycoord;
}

in the second line an ( is expected. Why???
Any suggestions?

Martin
Title: Re: trouble with character[name].moving
Post by: Ashen on Mon 21/11/2005 11:57:40
Again, READ THE MANUAL:
QuoteStopMoving (character)
(Formerly known as global function StopMoving, which is now obsolete)

Character.StopMoving()

Stops the character moving and sets its graphic to the standing frame of the current loop.

So:
function PlaatsDraden(int DraadID, int xcoord, int ycoord) {
if ( character[DraadID].Moving )  character[DraadID].StopMoving();
  character[DraadID].x = xcoord;
  character[DraadID].y = ycoord;
}
Title: Re: trouble with character[name].moving
Post by: spook1 on Mon 21/11/2005 12:09:28
Quote from: Candle on Mon 21/11/2005 11:51:10
Why not make a char with the hat on and change to that view and the other view when he takes it off?

Because actually I have a vehicle with soem wiring that can be turned on and off. i have 10 wires => many many combinations. It would mean to draw loads and loads of sprites..