Always animating object (SOLVED)

Started by Hans, Fri 05/01/2007 11:22:29

Previous topic - Next topic

Hans

I am making my first game and I am trying to make an aquarium in it. I made al the sprites. I can even put them in a view, but when editing the room, I can only choose one (!) picture for the object.
This means for me that my fish won't move and that is not I want .
I really (!) tried to find the anwser, but it still isn't clear to me.
If I really have to use some sort of code, please tell me exactly where to put it and try to make me understand what it all means.
I hope I will get a good reaction, so that I can always make the aquarium animate.

Greetings, Hans

PS.: Don't advise me to use an animating background. I have my reasons to make it an object.

Ishmael

In the room editor, click the interactions button - the one with an i on it - and double click on Player Enter Room (before fadein), the select Run script from the dropdown menu in the appearing dialog, and use the object.Animate script command:

(from the manual)



Animate (object)

(Formerly known as AnimateObject, which is now obsolete)
(Formerly known as AnimateObjectEx, which is now obsolete)

Object.Animate(int loop, int delay, optional RepeatStyle,
               optional BlockingStyle, optional Direction)

Starts the object animating, using loop number LOOP of its 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 RepeatStyle parameter sets whether the animation will continuously repeat the cycling through the frames. This can be eOnce (or zero), in which case 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 RepeatStyle is eRepeat (or 1), then when the last frame is reached, it will go back to the first frame and start over again with the animation. If RepeatStyle is 2 then it will do the animation once, but then return the graphic to the first frame and stop (whereas repeat=0 will leave the graphic on the last frame).

For blocking you can pass either eBlock (in which case the function will wait for the animation to finish before returning), or eNoBlock (in which case the animation will start to play, but your script will continue). The default is eBlock.

direction specifies which way the animation plays. You can either pass eForwards (the default) or eBackwards.

You need to use SetView at some stage before this command, in order to set up the object's current view.

Example:

object[0].Animate(2, 5);
object[1].Animate(1, 3, eOnce, eBlock, eBackwards);

will animate object 0 using loop 2 of its current view, at speed 5, and play the animation once only. This happens in the background. Then, object 1 will animate backwards using loop 1 of its current view, at speed 3. The function won't return until the animation is finished.



Set RepeatStyle to eRepeat, and the other parameters to match your views and loops, and you should be done with it.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Khris

Quote from: Hans Cronau on Fri 05/01/2007 11:22:29[...] I can only choose one (!) picture for the object.

AGS is no WYSIWYG editor.
Please do the tutorial in the manual, search/browse this forum and check the Beginner's FAQ before asking basic questions like that in such an awkward, demanding way.

And welcome to the forums.

Hans

Quote from: KhrisMUC on Fri 05/01/2007 17:58:41
Quote from: Hans Cronau on Fri 05/01/2007 11:22:29[...] I can only choose one (!) picture for the object.

AGS is no WYSIWYG editor.
Please do the tutorial in the manual, search/browse this forum and check the Beginner's FAQ before asking basic questions like that in such an awkward, demanding way.

And welcome to the forums.

Thank you for your advise. But I already tried. I read the manual, I did the tutorials, I read the forums and did what they said, but it didn't work. Probably because I don't know where to place the code.
I just had to tell you.
Bye.

Hans

You're the best! I know I oversaw something. " I " usually stands for "information". Thank you again. Really a beginners question I guess.

SMF spam blocked by CleanTalk