animated sprite,charictor or animated background

Started by Mechwar88, Sat 10/04/2004 19:42:27

Previous topic - Next topic

Mechwar88

I'm new to AGS just kind of played around with it a little but the game that i'm working on now i want to put a sign in the background that changes it's not large so i was wonderg if i do it with a sprite make it a cahrictor or make the background animated.  or is there a script to use?  Any help would be terrific thanks all!

Darth Mandarb

If there are many things you want animated in the background I would say just use multiple background frames.

However, if there's interaction(s) with the animated object, I would suggest making it just that.  An object.

For instance, if it's something that changes when/if you interact with it, it's easier to use an object.

There's no reason (that I can think of) to make it a character.

subspark

#2
What if the background is the object...

Lets say I have these windows covered with blinds. The background is drawn with them closed and a hotspot is made for them. Now when the blinds are opened the room is brighter and some sunbeams come in.

Or lets say your in a dark cave, and the room is pitch black except for maybe the entrance from which you came. You move the mouse around blindly looking for hotspots and you find one named "lightswitch" you use it and the room suddenly lights up.

I doubt it's possible to call a specific frame from a backgrround animation to display infact I doubt you can write scripts for the background frames at all.

My point is, wouldn't it just be easier if I could say type:

room[0].Animate(5 //frame, -1Ã,  //Time till reset)

Or something alike?

Is there any hope for me and my interactive background states or does Chris plan to rewrite the background animation feature alltogether? I wouldn't argue thereÃ,  8)

Cheers guys!

Ashen

#3
QuoteI doubt it's possible to call a specific frame from a backgrround animation to display infact I doubt you can write scripts for the background frames at all.
On the contrary:
(From the Manual)
Quote
SetBackgroundFrame
SetBackgroundFrame (int frame)

Locks the background to frame number FRAME of an animating-background screen. (Values for FRAME are from 0 to 4). This allows you to use the animating backgrounds feature for another purpose - you can have two frames of the background, one for example with a spaceship crashed on it. Then, once the right event has happened, call SetBackgroundFrame in the Player Enters Screen event to set the background before the screen fades in.
Call SetBackgroundFrame(-1) to set the default animating frames.

QuoteGetBackgroundFrame
GetBackgroundFrame()

Returns the number of the current background being displayed. In a room without animating backgrounds, this will always return 0. Otherwise, the current frame number is returned from 0 to 4.
Example:

if (GetBackgroundFrame()==4)
  object[2].Visible = true;

Using these commands the example you gave is totally possible - in fact, it's pretty easy.

EDIT: Just realised this thread was over a year old. subspark, I think it'd have been OK to start your own.
I know what you're thinking ... Don't think that.

subspark

#4
Oh ahh. Hehe. Whoops. I guess my own thread would have been handy.
I just was looking for solutions to my problem when I found this thread and thought it was similar.

Your quite right. Thankyou for your super generous help my encouragble friend.

Just one last thing, how could I stop the animation delay. Is there a specific symbol for infinity like -1 (which I tried BTW to no avail)? I want the frame to hold until changed via script instead of changing automatically after a period of time.

I shall read the manual more carefully this time.

Cheers again!

EDIT:
Well so far I've had no luck with SetBackground().

So instead I tried MergeObject() which is basically appropriate for the state of my room however when the game runs this line there are artifacts before the room corrects itself. Artifacts in terms of unchanged parts, boxes if you will before the whole background changes properly.

I've tried everything! I've even created a non clickable character with the altered room graphic but it sits in front of the character. So do objects even if I throw the baseline right up to the top of the screen.

I can't understand it. Argh!

Ashen

#5
QuoteI shall read the manual more carefully this time.
Well, you could start by reading the bits I quoted.

You can't (AFAIK) change the speed the background animation runs at in game*. However, using SetBackgroundFrame(x) (where x is the frame number 0-4) will lock it to that frame until you change it in script - so, put it in Player enters screen (for example, as mentioned  in the manual quote) to keep the background from changing until you want to. SetBackgroundFrame(-1) will start the animation running again - or have no effect, if the animation is already running.

*Well, I suppose you could script it, using SetBackgroundFrame() and a Timer or variable to set the delay. You could also use this to change frames randomly (i.e. not always in the same sequence). (And, yes, there's the 'Animation delay' box on the room editor panel, but that's not in-game).

QuoteI guess my own thread would have been handy
Don't worry about it. It'd just be useful for people searching for this in the future. Although, you found this thread, so they probably could too.

In reference to you second post - could you be more specific about what you're trying to do? There might be an easier/better way to achieve it.

Quoteeven if I throw the baseline right up to the top of the screen
If 'right up to the top' means 0 y coord, that returns the baseline to the bottom of the object/character, rather than actually at the top of the screen. Again, could you describe what you want to do.

And, in the future, modify your posts, instead of double posting.
I know what you're thinking ... Don't think that.

subspark

I have managed to solve my problem.

Thanks for your help!

Ashen

Do you mean, that (my last post) was the problem, or that you sorted something else. If so: Care to explain what/how, for anyone else with the same problem?
I know what you're thinking ... Don't think that.

Candle

Thanks for showing all of this as it has help me with what I wanted to know about working with the Backgrounds.
Great stuff .

SMF spam blocked by CleanTalk