Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: DragonRose on Thu 23/10/2003 18:28:21

Title: Vertical inventory scrolling
Post by: DragonRose on Thu 23/10/2003 18:28:21
Is it possible to scroll inventory items from left to right instead of just up and down?  I haven't been able to find anything in the manual about it.
Title: Re:Vertical inventory scrolling
Post by: DragonRose on Thu 23/10/2003 19:37:06
Okay, maybe I didn't explain what I'm trying to do so well.  I shall now add... PICTURES!

(http://invis.free.anonymizer.com/http://www.geocities.com/dragonrose_1/inventory.png)

I just thew this together, so things don't quite line up.  Anyway, what I want to happen is that when you click on the left arrow, the guitar case will go to the spot of the dress, the library card goes to the space of the guitar case, the book goes to the space of the library card and so forth.  If you click the right arrow, the opposite would happen.

LucasArts inventory is set up sort of like a grid, with the up and down arrows changing what row you're looking at.  If we were to look at the row beneath this image, it would be a whole different set of images.   I just want to bump things along one item at a time.
Title: Re:Vertical inventory scrolling
Post by: Ishmael on Thu 23/10/2003 20:19:26
First, set the inv info to match your inv window, ie. set the global variables game.items_per_line and game.num_inv_displayed to the right values, then, set the inv scroll code so that you scroll just one item at a time.
Title: Re:Vertical inventory scrolling
Post by: Paper Carnival on Thu 23/10/2003 20:23:12
No worry my friend!!

Quoteif ((button == 4) && (game.top_inv_item < game.num_inv_items - game.num_inv_displayed)) {
// scroll down
game.top_inv_item = game.top_inv_item + 1;
}
if ((button == 5) && (game.top_inv_item > 0)){
// scroll up
game.top_inv_item = game.top_inv_item - 1;
}

button4 is supposed to be the previous button and button 5 the next one. Note that I just changed the programming of the default code to scroll the inventory, so instead of scrolling a whole page left or right it just scrolls one item  ;D

Yeah! I just made my first helpful (towards somebody) post! I'm not a newbie anymore! :D

:P

EDIT: Well, I started to write this post before I read the other answer :P. It just took me a while to write the code down and check it, that's all...
Title: Re:Vertical inventory scrolling
Post by: Ishmael on Thu 23/10/2003 20:50:45
:D that's the code yup.