View Single Post
  #2  
Old 04-14-2012, 10:33 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
One way to do it is to keep track of your current position in the Inventory, then use a dual for loop to draw the amount of rows and columns you're after. I.e.

PHP Code:
//#CLIENTSIDE

function drawInventory() {
  
temp.rows 4// Rows
  
temp.cols  5// Columns
  
temp.spacing 2// Pixels between squares
  
temp.0;
  
temp.tx 100// Top-left X
  
temp.ty 100// Top-left Y
  
temp.icon_width 32;
  
temp.icon_height 32;
  for (
temp.0temp.temp.colstemp.x++) {
    for (
temp.0temp.temp.rowstemp.y++) {
      
temp.item getInventoryItemIcon(temp.i);
      
showimg(200 temp.itemp.itemtemp.tx + (temp.temp.icon_width) + temp.spacingtemp.ty + (temp.temp.icon_height) + temp.spacing);
      
changeimgvis(200 temp.i4); // Draws is on screen-level instead of player.
      
temp.i++; // You could do math to determine the item by x and y but a simple counter is easier
    
}
  }
}

function 
getInventoryItemIcon(item_pos) {
  return 
this.items[item_pos].icon// Placeholder...

__________________
Quote:
Reply With Quote