upsidown baseline

Started by YotamElal, Wed 27/04/2005 15:21:49

Previous topic - Next topic

YotamElal

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??

strazer

(S/he uses my suggestion from this thread.)

Try something like this:

Code: ags

// 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

  //...
}

YotamElal

Amazing

It works perfectly.



SMF spam blocked by CleanTalk