Get ShowPlayerCharacter property from Scripts?

Started by eri0o, Thu 12/10/2017 13:28:51

Previous topic - Next topic

eri0o

Hey,

Rooms have a property called ShowPlayerCharacter in the editor, that can be either true or false. How do I get that specific property value for the current room the player is, in the scripts?

Crimson Wizard

I don't think you can, this is one of the missing abilities. I may suggest to duplicate this flag as room's custom property and check that.

Khris

Or not use it at all, turn the player invisible in room_Load instead and check that.

eri0o

Guess I am going to use Room_Load to set transparency to 100 and Room_Leave to set it back to 0. :O

Khris

Thinking about this some more, it's probably better to move the player out of the screen instead, using player.y = -1; or something like that.
Mostly because a completely transparent but clickable character might still catch clicks.

As for using room_Load / room_Leave, you can also do this instead:
Code: ags
int playerY;
function on_event(EventType event, int data) {
  if (event == eEventEnterRoomBeforeFadein) {
    if (room == 2 || room == 7) {
      playerY = player.y;
      player.y = -1;
    }
    else if (player.y == -1) player.y = playerY;
  }
}


This will remove the player for room 2 and 7, and restore them to their previous coords for other rooms, but only if they were hidden upon entering the previous room.

SMF spam blocked by CleanTalk