Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 04/03/2007 16:13:35

Title: Urgent Question regarding object/character animation
Post by: on Sun 04/03/2007 16:13:35
Hello Everyone: I am a complete novice with creating a game with Adventure Game Studio so I need your help - and fast since I am making a game for my Papa's birthday which is coming up soon!
Here is what I am trying to do: I want to animate an object I created. I tried to do this by. . .
1. Opening Room Editor
2. Clicking on Room 2 (where my object is)
3. Clicking on the icon to go to Edit Room Script
4. Once I had the room script window open I typed in the following script:
Object[0].SetView(2);
object[0].animate(0,5,erepeat,eblock,eforwards);

In more detail: my object number is 0, the view number I want for my object is 2, I have only one loop (loop 0) for view 2, I want the delay to be the standard 5, I want the animation to have a continuous repeat, I want the function to not return until the animation is finished, and lastly, I want the animation to animate forwards. 

Every time I try to save the room the Game Studio shows an error, "unexpected object" it says. What am I forgetting? I would appreciate any help someone can give! Thank you for your time.

Sincerely,
Rebekah
Title: Re: Urgent Question regarding object/character animation
Post by: Akatosh on Sun 04/03/2007 16:34:31
Well, you can't put scripting operations directly in the room script. Instead, click on "Room interactions" (the button with an i), and create a new Run script action under "Player enters room (before fadein)". Put your code there. Should work.

/EDIT: Oh, and welcome to the forums!
Title: Re: Urgent Question regarding object/character animation
Post by: Ashen on Sun 04/03/2007 18:07:35
Mostly, what Akatosh said - which is also in the BFAQ (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#error:_.28line_xyz.29:_Parse_error:_unexpected_.28whatever.29).

However:
- If you want a Blocking animation, it will need to be in the 'Player enters room (after fadein)' interaction.
- Why are you using the eRepeat AND eBlock parameters? This will just lock your game up (control won't retutn to the player until the animation is finished - but the animation will NEVER finish). I know you said this is what you want, but it doesn't really make sense to me...
- You can leave off the eForward parameter, as that's the default behaviour (as is eBlock, if you're sure you want that, so you can leave that off too).


Also, be sure you get the capitialisation right in the actual code (object[0] not Object[0], Animate not animate, eBlock, eRepeat, etc).
Title: Re: Urgent Question regarding object/character animation
Post by: on Wed 07/03/2007 18:48:14
Ashen and Akatosh,

   Thank you both for your insight and suggestions. I followed your directions and have completely solved my problem and I have discovered many new ideas for animation for my game. Thanks again!

Sincerely,
Rebekah