Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Atelier on Tue 21/04/2009 18:45:55

Title: Inventory Items Overlapping
Post by: Atelier on Tue 21/04/2009 18:45:55
Hullo. I would like to know how you stop items overlapping in your inventory. At the moment, when the player receives his second item, the two icons appear on top of each other and it makes it difficult to use the one on the bottom. (And it also doesn't look very nice).

Do I need to add a function giving the x and y co-ordinates?

Thank you for taking the time to read my query.
Title: Re: Inventory Items Overlapping
Post by: monkey0506 on Tue 21/04/2009 18:57:05
What you're looking for are the InvWindow.ItemWidth and InvWindow.ItemHeight properties. That will allow you to specify the size your InventoryItems should take up. If you want to have them displayed outside of a rectangular-based grid you'd have to write your own custom script to handle it.
Title: Re: Inventory Items Overlapping
Post by: Atelier on Tue 21/04/2009 19:21:26
Thank you for the help.

Now that you have pointed me in the right direction, could I be awkward and ask how I would use those properties? Which script file do I place them in and how would I begin? Sorry for not getting it the first time; at the moment I'm using the excuse of not being too familiar with AGS.
Title: Re: Inventory Items Overlapping
Post by: monkey0506 on Tue 21/04/2009 19:25:46
If you open the GlobalScript.asc file and then go to the function game_start you could put something along the lines of:

invWindow.ItemWidth = 38;
invWindow.ItemHeight = 24;


Which would set each item in the InvWindow named invWindow to take up a rectangular box of 38x24 pixels. ;)
Title: Re: Inventory Items Overlapping
Post by: Atelier on Tue 21/04/2009 19:38:46
Yay!

After seeing your example, I figured out why it wasn't suggesting invWindow in the short-cut box and therefore confusing me.
I had my inventory window called invCustomWindow, by default.

Now I have corrected it and you have made my game that little bit better.

Thank you for helping,

Francis de Mont
Title: Re: Inventory Items Overlapping
Post by: Trent R on Wed 22/04/2009 00:43:06
You shouldn't have to script it in game_start, I believe those are listed in the properties pane when you have the inventory window selected in the GUI editor.


~Trent
Title: Re: Inventory Items Overlapping
Post by: monkey0506 on Wed 22/04/2009 06:22:42
Touché. ;)

But anyway I am glad you got it sorted out.