Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Attempting a simple-ish RPG inventory, need a little help

Author
Message
Reaper1481
7
Years of Service
User Offline
Joined: 16th Sep 2016
Location:
Posted: 6th Jul 2017 03:18
I've been a hobbyist programmer for years now, but I've always struggled with arrays. Currently, I use a for loop to draw a series of 48 (8 by 6) squares to represent the inventory. Each item only takes one square and some items can stack. I'm loading my items from csv files, but I'm stuck loading the images and the amounts in the actual inventory. Any help that anyone can offer would be greatly appreciated, thanks in advance!
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 6th Jul 2017 09:39 Edited at: 6th Jul 2017 09:44
Check out Types

you could have a type like this;


then have an array like this

you can access the values like this

Check out the array doco as well. to see how you can add things to the array

Hope this helps
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 6th Jul 2017 12:36
Quote: "but I'm stuck loading the images and the amounts in the actual inventory."


work out what the maximum amount of actual images you can display and chop your array into segments using a data pointer variable, for example, you can display 5 images but your in inventory contains 20 items, on first load display array items 0-4 setting the data pointer to 0, and assuming you have some scrollbar or buttons when clicked increment/decrement the pointer by 1 shifting the displayed items.

you might find it useful having 2 types 1 for the actual inventory and 1 for the list, this way you set the array index of the inventory to the item in the inventory display so when clicked you have the right item, using this system you can achieve scrolling by moving only the data pointer and not have to mess around moving images and such, if you get stuck I would be happy to code an example.

Login to post a reply

Server time is: 2024-04-26 01:46:11
Your offset time is: 2024-04-26 01:46:11