Untitled

 avatar
unknown
plain_text
3 years ago
1.2 kB
22
Indexable
bool Survolable(this Object*) {
  return this.GetProperty("Survolable") > 0 && this.View > 0;
}

function MetPasSurvole(this Object*){
  if (this.Survolable()) {
    if (this.GetProperty("Survolable") > 1)
      this.SetView(this.View,this.Loop,2);
    else
      this.SetView(this.View,this.Loop,0);
  }
}

function on_event (EventType event, int data) {
  if (event != eEventEnterRoomBeforeFadein) return;
  int i = 0;
  while (i < Room.ObjectCount) {
    object[i].MetPasSurvole();
    i++;
  }
}

function unhandled_event (int what, int type) {
  if (what == 2 && type == 1) { // what:2 = objet, type:1 = interact
    Object* survole = Object.GetAtScreenXY(mouse.x,mouse.y);
    if (survole != null && survole.Survolable())
      survole.SetProperty("Survolable",2);
  }
}

Object* anciennement_survole;
function repeatedly_execute() {
  Object* survole = Object.GetAtScreenXY(mouse.x,mouse.y);
  if (survole!=anciennement_survole){
    if (anciennement_survole != null)
      anciennement_survole.MetPasSurvole();
    if (survole != null){
      anciennement_survole = survole;
      if (survole.Survolable())
        survole.SetView(survole.View,survole.Loop,1);
    }
  }
}
Editor is loading...