Help with background object animation

Started by , Tue 28/02/2006 10:35:52

Previous topic - Next topic

otakuoverlord

Hi all, first post here, and at least to me a doozy.

Basically, there's a poor sap on a deserted island, and there's a smoking heap of aircraft left in the background (this is far funnier in the game, i assure you) and it has a smoke trail rising up off the wreckage. I'd like the smoke trail on the horizon to A) be animated and B) animate when the room is accessed (AKA background animation). Also, the smoke should loop until the room is exited.

I already have the smoke trail set up (a 4-frame animation, VIEW 2) and an object (object 2) set up to handle it. I've read the manual and it doesn't seem to say exactly where i should be putting this script I put together to get it to do what i want. <script edited so it doesn't get eaten by the forum filtration>

object [ 2 ] . SetView ( 2 ) ;
object [ 2 ] . Animate ( 0 , 25 , eRepeat ) ;

As is, when i have set this to the object's 'looked at' function, it locks the game in cutscene mode, which is not a good thing... I must be doing something wrong.

As a summary- I want to have a simple looping background animation that doesn't screw with the game itself.

Any suggestions or help would be appreciated!


I know enough C to get by and have been experimenting with AGS for a while so I can take instruction.

P.S. I searched the help file for a long while and went through a bunch of previous posts, but I didn't see a relevant answer. I know the rules, i swear!

Ashen

Have you checked out the BFAQ, particularly this entry?
Play close attention to this bit:
QuoteFirst, you need to think of where and when you want this to happen.

And this bit:
QuoteFor things that you want to happen every time a room is loaded, choose that room in the Rooms pane and, under Room/Settings, Choose the “i” button. You will see a list of events that you can use to trigger certain events.
...
For example, if you want the player to walk to a certain location after the room is loaded (each and every time), double-click on the Player enters room (after fade-in) event. You want after fade-in, because you won't see any animations or anything at all before the room fades in.
Which should also answer your question. Also note what it says in the manual, for Object.Animate
Quote
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.
So, you'll need to add the eNoBlock parameter to stop the game from freezing up.
(On an entriely random note - 25 seems like a hell of a delay. Once you get this working, you might find you want to decrease it a bit.)


As for the code - you can use the code tags - [ code ] and [ /code ], without the spaces - to preserve formatting:
Code: ags

object[2].SetView(2);
object[2].Animate(0, 25, eRepeat, eNoBlock);


I know what you're thinking ... Don't think that.

otakuoverlord

Thanks Ashen... fast reply!

for these 4 frames of animation (wispy, wimpy little smoke, 25x54 pixels!) 25 makes it a little less jerky, or at least i thought it looked good in the previewer. But then I remember the manual stating that the delay is an aggregate of two numbers, so in reality it may be way too slow!

Anyway- I Didn't know about the BFAQ. That explains quite a bit more than I can handle at 3 am local time, so I'll have to get on that after work today ;D A great supplement to the helpfile for sure.

That does indeed answer my question about how to get stuff to start automatically, etc.

And as for blocking, this is all new info for me. I didn't get the whole picture about blocking from the manual entries i read, i wasn't exactly sure what to make of it. I guess this requires more research and work than i originally anticipated!

antineff

Ts,ts! Always the same with those newbies! Always apologising! But you made the right thing: You asked!

I myself had always problems with the positioning of scripts. But it always has to do with programming logic, and you said you know some C and so I believe you know a little how computers "think".

What I want to say with this:

The definition of the animation you made seems to be alright so far. But, if you declare it for the interaction with the object, it is truly clear that it only works when you interact with the object (since this is, what you declared but not what you want). So clear so far?

What you want ist to have it animated during the whole scene, right? So you have to declare it for the scene, say for the room. You can choose between one of the three possibilities given for entering the room.

Excourse: If you want to come back later to the room and the smoke should have stopped then, you should place the animation instructions in the "First time player enters..."- Section and then stop the animation and switch it off when leaving the room. With this, the smoke is visible only with the first appearence of that room.

(Oh, I see Ashen has answered in the meantime. Alright, to get it double should even help twice :) )

The eNoBlock thing, Ashen mentioned ist absolutely important!!!

Good luck!
coming soon (or later, sorry!)

SMF spam blocked by CleanTalk