Creating an Inventory

You must understand the Game Editor concepts, before post here.

Creating an Inventory

Postby TheIllusionist » Fri Apr 03, 2009 6:00 am

I'm making a game but I'm stumped on the inventory style I want to use.
It has two rows, 4 squares in each row, and 2 arrows to scroll with. when an item is picked up, it goes into the first slot. If an item is in the first slot, it goes to the second slot and so on. When the first eight squares are filled, it goes down a row, giving 4 more squares on the bottom row, and can be navigated with the arrows mentioned above. How would I go about doing this?
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby jimmynewguy » Fri Apr 03, 2009 1:33 pm

Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Fri Apr 03, 2009 11:27 pm

That helped, but I forgot to mention the second part. In the demo you showed me, you click a button to be able to pick up an item, but in my inventory there are 9 buttons; Give, Pick Up (already explained), Use, Open, Look at, Push, Close, Talk to, and Pull. How can I make it so when I'v selecte one option, I can change to another without the previous option sticking?
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby skydereign » Sat Apr 04, 2009 1:46 am

I think you are talking about the demo I made. I could edit it for that purpose if you want, but what I would do is use a variable. And upon clicking the items in the inventory, or pressing a key, I would determine the proper event, using a switch statement. Though to change it to what you want, I would need to know a little more. Are you talking about events on the items in the inventory? Or are they events to items outside the inventory? I am pretty sure in my demo, all you do is pick them up, and then use them, or some such. You want to be able to do multiple things to the items depending on what mode you are in, right?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Sat Apr 04, 2009 4:18 am

The different options are for both inside and outside the inventory
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby skydereign » Sat Apr 04, 2009 5:32 am

Okay, here is a small version of what I was talking about. The difference is in the mouse down events, and that there is now a variable called ActionNum. The text explains what the numbers would signify. Now in the click events, there is a switch statement, this determines what events to do depending on ActionNum's value. Just create more cases, one for each event. If you need more help, just ask. One thing to note, I have found a couple bugs/places to improve, so this is not a perfect inventory. I may improve it later if you wish.
Attachments
Inventory2.zip
(136.79 KiB) Downloaded 167 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Sat Apr 04, 2009 5:39 am

Well... the main idea is right, but instead of pushing a number, you click the option. And also, when you move your cursor over an option, it lights up.
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby skydereign » Sat Apr 04, 2009 5:43 am

Do you need help with that? I can set up a demo of that if you wish.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Sat Apr 04, 2009 6:02 am

A demo would be great. :mrgreen:
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby skydereign » Sat Apr 04, 2009 6:24 am

Here it is. Any other questions, feel free to ask, or if I missed something with this demo. The number press is still there, but you can now click the lit up tile.
Attachments
Inventory.zip
(157.23 KiB) Downloaded 180 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Sat Apr 04, 2009 6:39 am

This is the perfect inventory :mrgreen: Thanks a million

+2 :mrgreen:
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby skydereign » Sat Apr 04, 2009 6:43 am

So you know, if you take the 8th item, you will not be able to scroll down anymore... This was one of the bugs I was talking about. You may or may not come across it, but if it becomes a hindrance, just tell me.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Sat Apr 04, 2009 7:23 am

There was just a couple things I want to know. 1. When you click use, then right click an item, it disappears. How do I make it so that it stays? 2. After I click the action, you do I use said action with an object?
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Re: Creating an Inventory

Postby skydereign » Sat Apr 04, 2009 4:24 pm

Do you mean depending on what item? Because to make an actual use from the item, you would just change the case 2 event triggered by a right click. If you look at the right click event, there are some if (itemtype[ofst(a,0]==1), I would actually put a switch there instead. So the entire script looks like this.
Code: Select all
switch(ActionNum)
{
    case 0: //Give
    // The code for Give
    break;
    case 1: //Pickup
    // Probably nothing, as this is clicking in the inventory, meaning you already picked it up
    break;
    case 2: //Use
    switch(itemtype[ofst(a,0])
    {
        case 0: //Item type 0
        // Your event for item type 0
        break;
        // make a case for each itemtype
    }
    break;
    // make a case for each ActionNum
}


In the existing code, there is a reset, itemtype[ofst(a, 0)]=0;. This is what gets rid of the item. The above does not have that.
Last edited by skydereign on Sun Apr 05, 2009 7:31 am, edited 1 time in total.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Creating an Inventory

Postby TheIllusionist » Sat Apr 04, 2009 6:53 pm

In this demo, you only need to click pick up once to collect all the item. How do I change that?
"Have we not each experienced the beautiful sensation of a moment pass to quickly, and wished that we could make it linger?"
User avatar
TheIllusionist
 
Posts: 19
Joined: Fri Apr 03, 2009 1:49 am
Location: Vienna, Australia
Score: 0 Give a positive score

Next

Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest