Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: stars on Fri 14/08/2009 10:35:40

Title: Animated objects on the screen.
Post by: stars on Fri 14/08/2009 10:35:40
I have several animated loops which I have created as views.  Just cant figure out how to add the animated "things" to my rooms.  I dont really want to do a complete animated background.  

I have checked the manual and looked through the forums but either am looking for the wrong thing or it isnt there. (Which I doubt).

Say I have an animated flag and want it to show on my background.  Just want to place it on the background et voila.  A bit like a character I guess.
Title: Re: Animated objects on the screen.
Post by: Matti on Fri 14/08/2009 12:21:56
You create an object and use object.Animate to animate it. It's all in the manual.
Title: Re: Animated objects on the screen.
Post by: Khris on Fri 14/08/2009 13:00:40
Yeah, going from your first post here you know about objects, so what exactly is the problem?
Add the "player enters screen before fadein" event the room, in there animate the objects using eRepeat and set their .Clickable to false.
Title: Re: Animated objects on the screen.
Post by: stars on Fri 14/08/2009 14:31:32
Thanks for the help. I am getting some success now.  Just need to sort out the enters room before fadein as the screen just goes black.  I will check the manual....
Title: Re: Animated objects on the screen.
Post by: stars on Fri 14/08/2009 15:07:27
Okay got it sorted.  I guess i didnt understand the relationsship with objects and views etc.

Heres what I did.

Created an object.
Assigned a view

function room_Load()
{
object[0].SetView(2);
}


function room_AfterFadeIn()
{
object[0].Animate(0, 5, eRepeat,  eNoBlock);
}
Title: Re: Animated objects on the screen.
Post by: tzachs on Fri 14/08/2009 20:18:56
Hi, a little piece of advice regarding your code... When you create an object, you can name it in the designer (to say, "oFlag"), and then you can use the flag object like so:

oFlag.SetView(2);

This way, the code is more readable then if you use object[0], and if you'll look at the code a couple of months from now you'll be able to understand what you did more easily. The object structure is intended to be used if you want to access your object from outside the room you're in (and then you can't use the name of the object since it is only created locally in the room).
Title: Re: Animated objects on the screen.
Post by: Khris on Sat 15/08/2009 01:43:13
stars, you can move the .Animate command to the room_Load function I think.
Title: Re: Animated objects on the screen.
Post by: suicidal pencil on Sat 15/08/2009 20:57:42
to my knowledge, the only things that are allowed to animate are Characters and Objects.