Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Liliana on Sun 12/08/2007 16:31:25

Title: Changing look of an background
Post by: Liliana on Sun 12/08/2007 16:31:25
I'm still in theorethic thinking, but I wonder how would I change the look of an background and all of the present objects and people (character being a werewolf and wolves see far less colours than people), obviously, I'd have to make another set of rooms and objects for this, but I just donť know how to change view of an exact room by a command in GUI. Variables would be a choice, I think, but I hope there is an other way, there will be (at least I'm planning) too many rooms. I'm wondering, isn't there even a way how to change such things without dual rooms? I know, it's a bit stupid question.
Title: Re: Changing look of an background
Post by: Khris on Sun 12/08/2007 16:57:17
Each room supports up to five different background images, originally meant to continuously animate the room.

But you can use them to change the background by calling the SetBackgroundFrame() command.
Objects are unaffected by this, of course, so you'd have to use an alternative sprite for every object, too.
The easiest way I can think of right now is to have the werewolf sprite use the original sprite index +1.

Then use on_event to change the appearance of the room.

function on_event(EventType event) {
  if (event==eEventEnterRoomBeforeFadein) {
    int si;
    if (GetBackgroundFrame()==0 && player_is_werewolf) {
      SetBackgroundFrame(1);
      si=1;
    }
    else if (GetBackgroundFrame()==1 && !player_is_werewolf){
      SetBackgroundFrame(0);
      si=-1;
    }
    int i=0;
    while(i<Room.ObjectCount) {
      object[i].Graphic=object[i].Graphic+si;
    }
  }
}
Title: Re: Changing look of an background
Post by: Charity on Mon 13/08/2007 23:06:00
If you can live without transparency and tinting/lighting individual sprites, you might be better off doing your game in 256 colors.  Then create a function to modify every slot in the palette and remove/gray/whatever any colors a wolf shouldn't be able to see.  Palette stuff is a little tricky to figure out, at first, but it would mean that you never have to redraw/recolor anything manually.

If that makes sense.