Getting a property of any hotspot

Started by joelphilippage, Thu 09/08/2007 21:14:48

Previous topic - Next topic

joelphilippage

Hello. I was trying to write a script like loom were if you click on a hotspot it will show an Icon representing it on the gui. Ive created a property called Icon that has the sprite number of the hotspot. how could I get this to work for all hotspots without typing a script for all the possible ones?
Here is the code:
Code: ags
else if (GetLocationType(mouse.x,mouse.y)==eLocationHotspot){
    icon.NormalGraphic = hotspot[1].GetProperty("Icon");
HotspotName.Text = Game.GetLocationName(mouse.x, mouse.y);
  }



monkey0506

That's precisely what pointers are used for!

Code: ags
  else if (GetLocationType(mouse.x,mouse.y)==eLocationHotspot){
    Hotspot* h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
    if (h != null) {
      icon.NormalGraphic = h.GetProperty("Icon");
      HotspotName.Text = h.Name;
    }
  }

SMF spam blocked by CleanTalk