How to indicate game location on the icon bar?

Started by therealraafuru, Fri 20/03/2015 15:08:24

Previous topic - Next topic

therealraafuru

In my game there are several cities: basically a collection of rooms. When you're not in a city you're on a numbered route (like in Pokemon).

I have modified the icon bar by removing buttons which I don't need. In the resulting extra space I want to put a panel that indicates to the player which city or route they're on. Is there a way to do this?
Aw mah gawd... They killed Kenny!!!

Slasher

#1
You mean like a map indicator of where you are?

Of course there is a way and it depends how you want it displayed.

Basic example:

you could make the map as background for the gui (or button with image) then use another button (with indicator image) to show where you are by adjusting it's x y position.

I have just implemented a similar map in my latest game.


therealraafuru

Not exactly a map, but like a sort of "label" that shows the name of the city or route number.
Aw mah gawd... They killed Kenny!!!

monkey0506

You could add a custom text property to the room and then use Room.GetTextProperty in the GlobalScript's on_event for eEventEnterRoomBeforeFadein:

Code: ags
// GlobalScript.asc
// Room property is created in the room editor - we'll call it "Name"
// Also in the GUI editor, add a GUI Label control to your icon bar - we'll call it "lblRoomName"

function on_event(EventType event, int data)
{
  if (event == eEventEnterRoomBeforeFadein)
  {
    lblRoomName.Text = Room.GetTextProperty("Name");
  }
}


And that's it! No additional code to have to remember to copy into room scripts or anything like that, just set the name for each room in the custom properties editor once and you're done.

therealraafuru

Aw mah gawd... They killed Kenny!!!

SMF spam blocked by CleanTalk