How to record state info regarding background image

Started by Triad47, Fri 13/08/2010 03:35:15

Previous topic - Next topic

Triad47

I'm creating a first-person game like Myst.

There tends to be a lot of "switch" puzzles, like open and closed doors, levers pulled and pushed, lights that can be switched on and off, etc. How would you recommend saving all this state information?

My initial thought was having a separate background image for each state, though we're limited to 5 backgrounds per room. The number of states will exceed that in some rooms. (e.g. light on, door closed, window open) is 2x2x2 = 8 combinations meaning 8 possible renderings to show.

Is there a way to "replace" the background image with a custom one in code?
How would you implement this?


Thank you


Alun

I'm probably the wrong person to answer this, since I have yet to finish an AGS game myself (and in fact have barely started actually implementing any beyond the planning stages), but since I'm pretty sure I know the answer I'll try to answer it anyway.

Objects.

Look into Objects in the AGS documentation.  That's what you want to use.  An Object is overlaid over the background (though it can be much smaller than the background image), and can easily have its graphic changed.  If you have a room with, for example, ten switches, you don't need 1024 different background graphics -- just have each switch as an Object, and use Object.Graphic or Object.Animate to change each switch from an up to down position, or vice versa.  Much easier to just deal with Objects for things in rooms that change rather than messing with creating whole new backgrounds in the code.  That's what Objects are for.

Soup - The Comic Strip
http://www.soupcomic.com
Gods, heroes, monsters, and soup


SMF spam blocked by CleanTalk