Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: YotamElal on Wed 27/04/2005 15:21:49

Title: upsidown baseline
Post by: YotamElal on Wed 27/04/2005 15:21:49
my character can walk on the cieling but I have a lamp on the  cieling with a walkbehind,
the problem is that when the character is bellow the baseline he should be behind the lamp.
Is there a way a could make the baseline work upsidown??
Title: Re: upsidown baseline
Post by: strazer on Wed 27/04/2005 15:40:33
(S/he uses my suggestion from this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=20494.msg250887#msg250887).)

Try something like this:


// room script

//...
#define LAMP_BASELINE 50

function repeatedly_execute_always() {
  //...

  if (GetWalkableAreaAt(character[GetPlayerCharacter()].x - GetViewportX(), character[GetPlayerCharacter()].y - GetViewportY()) == CEILING_ID) {
    // if character is on the ceiling's walkable area

    if (character[GetPlayerCharacter()].y - GetViewportY() < LAMP_BASELINE) // if character is above lamp
      SetCharacterBaseline(GetPlayerCharacter(), game.room_height); // draw character in front of lamp
    else // if character is below lamp
      SetCharacterBaseline(GetPlayerCharacter(), 1); // draw character behind lamp

  }
  else // if character is not on the ceiling's walkable area
    SetCharacterBaseline(GetPlayerCharacter(), 0); // reset character's baseline

  //...
}
Title: Re: upsidown baseline
Post by: YotamElal on Thu 28/04/2005 13:27:49
Amazing

It works perfectly.

Title: Re: upsidown baseline
Post by: strazer on Thu 28/04/2005 13:56:52
Cool!