• Advertisement
Sign in to follow this  
  • entries
    246
  • comments
    175
  • views
    153923

diablo inventory

Sign in to follow this  

283 views

well, i got tired of having to add html stuff to the txt when i was dropping posts in here, so i'm going to start saving my journal entries as html and hand-code it. copy-paste should be quicker, and i'll just have to change a few urls instead of adding a bunch of tags everywhere.

ok. instead of trying to make entire games, i need to go back to my roots, the original journal. when i was working in that, i was just trying little things that weren't really significant on their own, but eventually i'd have enough insignificants that i could combine into something worthwhile. i think thats a better goal. eventually i'm going to have some insignificant things that are pretty cool and i might want to put into a 'final' directory in here. i wasn't doing that before and it was getting difficult to find things i wanted quick access to.

so what interests me right now? halo/2, diablo/2, zelda/SoM, chopper commando, that 2d motocross physics game, and maybe Demolition Derby. what part of which game do i want to look at and try to do? or do i want to make a 2d vector class, or a ddraw wrapper? so many things to choose from. right now i'd say diablo is foremost in my mind, and of the things i could look at, items and the inventory are what i'm most interested in.

[working] well, i just went out and had to relearn frameset and frame but now i have a better index than i had originally. right now i'm going to only add it by date, but eventually i'm going to have a categorized listing you can select from as well. i want to have a clickable folder icon for my local copy so that i can open its source folder quicker than scrolling around for it. of course, it'll have to be hand-edited for now, but who knows what the future may bring.

so i was thinking about what i'd do to play with the items and inventory. i envisioned a simple window (or fullscreen) split in half. the right half will display an inventory window, not unlike d2's. the left half will have a series of sprites on a background. when you click on the sprites, they go into your inventory if they fit. if they fit, they appear in the inventory area on the right and they disappear from the 'action' half. if there's no room, the object is thrown into the air and lands where it was to begin with, just like in d2.

now, with the inventory side, you'll be able to pick up the items in the inventory and move them to somewhere else valid in the inventory screen. if you decide instead to move the mouse over to the left play area and try to drop an item into the play area, it'll pick that spot and throw it in the air, to land where you clicked or let go of the drag. the whole exercise should help me when i'm looking at my gba-styled version of diablo.

as much as i want to start looking at that version of what i want to do, i really need to try to do what diablo does. i should probably only let things drop in a grid slot, so that there won't be any chance of overlap. also, i suppose i'm going to need to have the computer find the nearest spot open from the spot you dropped the item. in diablo, you weren't able to drop if the 9 tiles around you already had items. that might be a quick-n-easy option. thats another project i can look into. that means i can't just drag-drop, so i'll just have it click once to pick up, click a second time to drop.

i'm getting closer to something i can handle. (side note: the 1/4-phased moon outside my window right now is half-covered with clouds and it looks super creepy. cool!) anyways, the easiest way to do this is to just to rip some gfx from zelda4(gb). i'll 2x the graphics so that they'll be visible (maybe have a menu option to pick from a few different size multipliers eventually).

so i'm going to have an item class that will need to contain: a name (to be displayed on mouse-over), a play-area graphic and location on the play-area (do we need a class for this?), an in-inventory graphic and size info (will definitely need another class for this). hmm. anything else? i'll do the toss animation like they did it in z4(gb) where theres just a shadow and it pops up into the air, but no bounces. just a quick anim.

so now we'll just be running through every item location when we catch a click and if its the tile you're clicking, its picked up off the ground (we'll set the location to nothing or -1,-1 or something) and it goes into the first available spot in inventory for its size. that's going to be a project on its own.

so where am i at now? can i start coding this? it seems too conceptual yet, not enough work has gone into figuring it out. for one, i'm going to be relearning gdi+ for this (why bother with dx?) and i need to make some interesting decisions. for one, the map screen will be an altered screencap of z4(gb). i say altered, because i don't know of any single screen that is completely devoid of blocking tiles. i want the user to drop anywhere. also, i might want to avoid screens with lots of tall grass, i don't want to have to deal with the grass-over sprite.

i suppose i don't have to do it left/right, i could go top/bottom - i don't see the difference. an item screen is an item screen no matter where it is. hmm. i realize now that if i'm going to have the items NxM sized in inventory, i'm going to have to come up with my own drawings for them. thats ok, i can do some pixel-art if i need to.

so what items am i going to have, and how many of them will there be? i suspect that 8 is a good number, let's see what we can come up with. the Sword, Sheild and Bow immediately come to mind. Arrows and the Boomerang, the Firerod and a Book could fill more slots. i want to avoid using the money because that wouldn't make sense to put in inventory and would work a bit differently. perhaps i should avoid arrows as well, arrows are stackables and i think i want to avoid that complication for now. the Bracelet is another item, and... hmm. oh! the ocarina. thats good. i'll have to make the Book sprite myself, but oh wells. here's what we're going to have:


  • Sword - 1x3 - "Master Sword"
  • Shield - 2x3 - "Large Shield"
  • Bow - 2x3 - "Short Bow"
  • Boomerang - 2x2 - "Boomerang"
  • Firerod - 1x2 - "Wand of Flame"
  • Book - 2x2 - "Book of Wizardry"
  • Bracelet - 1x1 - "Bracelet of Strength"
  • Ocarina - 1x2 - "Ocarina of Time"


i'll just simulate a tooltip above the mouse pointer if you're not holding anything, and let it follow the mouse. the less complicated we can make it, the better.

something i forgot about was the item location in inventory. that could be shared though, with the game window location, if we add a bool to report whether the item was in inventory or on the play area. what about if its on the mouse pointer? its location wouldn't make any sense. so i guess another bool might be in order, or perhaps a ItemLocation enumeration {InPlayArea, InInventory, OnMousePointer}.

this demo shouldn't need to hook Main into an endless loop - and the Click event can trigger an animation draw.. hmm. i suppose i don't need a jump animation, whats the point? simple simple. this should be pretty straightforward from here. the classes will need work, though.

lets start up a project. [working] ok lets set up the image we'll be clearing the client area with in our Paint event handler. i want some screenie from z4(gb) and the same size under it that will have space for 10x4 inventory slots. i'll just 2x all the graphics before i add them. [working]

ok i'm going with left/right. its not going to be 10x4, it looks like its going to be .. err, wait. i don't want the inventory grid to be spaced as 16x16 do i? wouldn't 8x8 be better? hmm. no, its a 5x8 grid, so lets just go with that. i know i said i shouldn't use the tallgrass tile, but i don't have to worry about the grass-over sprite. keepin it simple. [working]

ok. got 'er. now i get to make the item class. [working] ok, so far so good. this is probably not as efficient as it could be, but who cares. "get it working first, worry about optimizing later". right? right. ok, so i'm just going to load the graphics right into the resource manager. resizing the form with the background image wasn't too hard once i looked up Form1.Designer.cs. [working]

ok wicked. the Item class constructor i made takes some info that will construct a fully working item and place it on the play area. i'm probably going to want to catch the clicky for the picturebox though, aren't i? i'm probably going to have to deal with some of the defaults PictureBox starts with, like AutoSize or that kind of thing, but its going to work so far.

another thing to bring up is that the items should be dropped on the map at random, but you're going to determine where they're dropped when you call the constructor. so thats up to me. i'm going to likely have a Collection of Items and as i create new ones to Add, i'll iterate through the Collection to make sure our randomly generated location is'nt already taken.

back to the PictureBox.Click event deal. we definitely want to catch it, its the most obvious way to do all of this. i'll add that in now. [working] fucking awesome. this is coming together super good. ok, here's where we back out and try to make an item or two and add them to a Collection stored somewhere. we'll be setting up the Items in Form_Load. so i guess lets get the sword Item up and running. [working]

found a nice sword pic to use for the inventory version, check this out. i've beat the crap out of its resolution, but whatever. lets get this puppy up and runnin! [working] wow. i have no idea why its not showing up. oh fuck. i forgot to add it to the control set. real smart, dickhead. [working] yeah of course that was it. jeez.

and i was right about the default PictureBox sizing, i'm just going to set AutoSize to true. [working] awesome. i actually had to change SizeMode to AutoSize, not what i just said. oh well, whatever. now i get to move on to handling our first click! what's going to happen, you ask? WELL! i have no idea. i need sleep now. [gone]

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement