Can't select inventory object in inventory screen

Started by DoctorDan, Sun 01/06/2014 18:00:58

Previous topic - Next topic

DoctorDan

Just beginning here so this is a quite basic problem, but I have been unable to find an answer elsewhere in the forums or tutorials.

I am having trouble with an inventory item.

The item is picked up, added to and shows in the inventory as it should be but I am unable to select and drag it to use it from the GUI.

Is there something obvious I am doing wrong or need to check?



Vincent

you can try to search this section on the manual : GetAtScreenXY (inventory)

Returns the inventory item at SCREEN co-ordinates (X,Y).

Code: ags

InventoryItem *item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if (item == null) {
  Display("No inventory item at the mouse co-ordinates");
}
else {
  Display("Inventory item number %d at the mouse.", item.ID);
}

Khris

I assume you have created a default game?

A common reason for this is a pretty huge inventory item sprite compared to the inventory window's relatively small ItemWidth and ItemHeight.
When you try and pick it up by clicking near the center of the sprite, you're outside the bounds of the active area and nothing happens.

Open gInventory in the GUIs node by double clicking it, click inside the white rectangle representing the InventoryWindow, then change its ItemWidth and ItemHeight properties according to the pixel dimensions of your inventory items.
This will also ensure that the items line up properly inside the window.

DoctorDan

Khris this seems to have solved the problem. Thanks so much for the assistance.

SMF spam blocked by CleanTalk