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.

Code Snippets / [DBP] - Diablo-style Inventory v.1

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Aug 2011 23:37
It's still a work in progress, hence the lack of comments I typically put in my code. But considering how much stuff I have going on this month (and the fact I'll be gone til next year) I thought I'd share what I had so far.

Press the tilde (to the left of the number 1 key) to activate the inventory screen. Spacekey will create a random item and place it "in-hand". You can put it onto either side of the inventory, but each side is managed independently. I plan to improve that. Green means the item is safe to place, red means it either doesn't fit or another item is in its way. On the left-side of the inventory, you can pick up already placed items and move them elsewhere. Keys and scrolls can be stacked.

Attachments

Login to view attachments
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Aug 2011 23:37 Edited at: 8th Aug 2011 23:38
Here's a screenshot. The numbers you see just indicate how many stacked items are present at that location (which is only keys and scrolls).



Attachments

Login to view attachments
leo877
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 15th Aug 2011 07:36 Edited at: 15th Aug 2011 07:36
phaelax
this is cool. i also like the background and items drawning. what program use to make them.


French gui
19
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 15th Aug 2011 18:56
Wow , again well done Phaelax! I vote for a Gold Codemaster!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Aug 2011 04:30
The item graphics are from diablo, but the background image was used from deviantart with a link in the source to the artist's page. I used them solely to help demonstrate the code and should not be used in any released products.

leo877
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 16th Aug 2011 05:10
thats cool. i just want to know what drawing program was use, but sinse it borrow. i an not intenting to use them.


Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Aug 2011 11:14
I've redesigned the code a bit and ditched one of the 3 arrays used for managing the inventory. I now only use one array to hold the different items and one array to hold which of the items are in the inventory window. No longer need the grid array to keep track of where they're at due to the redesigned method.

For the updated code (and new graphics) I suggest looking at my WIP thread:

http://forum.thegamecreators.com/?m=forum_view&t=188498&b=8&p=0

Cwaldo39
12
Years of Service
User Offline
Joined: 28th Oct 2011
Location:
Posted: 29th Oct 2011 01:44
Do you plan on doing a "Stash" in your game?

http://www.kraftwurx.com

Login to post a reply

Server time is: 2024-04-20 04:35:11
Your offset time is: 2024-04-20 04:35:11