Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: therealraafuru on Fri 20/03/2015 15:08:24

Title: How to indicate game location on the icon bar?
Post by: therealraafuru on Fri 20/03/2015 15:08:24
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?
Title: Re: How to indicate game location on the icon bar?
Post by: Slasher on Fri 20/03/2015 15:21:10
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.

Title: Re: How to indicate game location on the icon bar?
Post by: therealraafuru on Fri 20/03/2015 17:02:36
Not exactly a map, but like a sort of "label" that shows the name of the city or route number.
Title: Re: How to indicate game location on the icon bar?
Post by: monkey0506 on Fri 20/03/2015 22:44:15
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) Select
// 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.
Title: Re: How to indicate game location on the icon bar?
Post by: therealraafuru on Sat 21/03/2015 11:25:38
It works. Thanks, monkey :)