Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: NemesisRogue99 on Sat 07/02/2004 20:51:04

Title: Animations and Characters...
Post by: NemesisRogue99 on Sat 07/02/2004 20:51:04
I have a character that I just want for the background...I have the animation loop and everything...I just can't figure out how to just have the animation play when you're in the room....Can anybody help me out?  Or give me any hints on how to improve upon this?
Title: Re:Animations and Characters...
Post by: Scummbuddy on Sat 07/02/2004 22:13:02
In the AGS Help file/Manual, there are 'Character functions'.  There you will find ones such as :
-------------------------------
AnimateCharacter
AnimateCharacter (CHARID, int loop, int delay, int repeat)

Starts the character named CHARID animating, using loop number LOOP of his current view. The overall speed of the animation is set with DELAY, where 0 is the fastest, and increasing numbers mean slower. The delay for each frame is worked out as DELAY + FRAME SPD, so the individual frame speeds are relative to this overall speed.
The REPEAT parameter sets whether the animation will continuously repeat the cycling through the frames. If REPEAT is zero, the animation will start from the first frame of LOOP, and go through each frame in turn until the last frame, where it will stop. If REPEAT is 1, when the last frame is reached, it will go back to the first frame and start over again with the animation.

If the character is moving it will be stopped.

Example:

AnimateCharacter(EGO,3,0,0);

will animate the character using loop number 3 of his current view only once.
See Also: AnimateCharacterEx, AnimateObject, SetCharacterView

---------------------------------------

I suggest you take a look in the manual before posting questions. If you have anymore questions, feel free to ask them though. Let us help.  Also a search on the forums is a good way to get questions you have answered.
Title: Re:Animations and Characters...
Post by: NemesisRogue99 on Sun 08/02/2004 17:11:11
Thanks, I found it in my manual, sorry I missed it...

I know this is probally a stupid question, but I can't find this in the manual....It tells me...

There was:
                  In Main Script:
Error(Line 2): Parse error: unexpected 'Animate Character'

...this is my script....basically nothing so far..

1// room script file
2AnimateCharacter(CGUY, 0, 3, 1);

But would you be able to tell me what I'm doin wrong?
Title: Re:Animations and Characters...
Post by: strazer on Sun 08/02/2004 18:22:08
Quote// room script file
AnimateCharacter(CGUY, 0, 3, 1);

You see, the room script file contains the room's variable declarations, functions (which contain your commands (=AnimateCharacter)) and so forth.

So an "unexpected 'AnimateCharacter'" is exactly that: When trying to run your game, the compiler expected to find a function or variable declaration there instead of the command you put there.

To create a function to put your command in, for example put an object in the room, then click its "Interaction..." button.
There, you select an action (What has to be done to execute your command?).
For example, select "Interact object", then select "Run script".
Now a function has been created in the room script.
IN THERE, you put your command.

Now whenever the player clicked on the object with the interaction mouse cursor, your command would be run.

Hope this helps.