Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Catacomber on June 28, 2009, 06:32:52 AM

Title: Using a sprite in inventory
Post by: Catacomber on June 28, 2009, 06:32:52 AM
I wanted to use a sprite of a door knob taken into inventory rather than just a png pic because the sprite lets me set the active point precisely on the handle so the handle connects nicely with the spot where it has to go.

BUT

In inventory the sprite is pushed way up so only the lower part is showing.  The sprite and the png it contains are the same size so I don't know why the sprite is pushed up so far in inventory.  Any thoughts?  I don't have to do it this way but it's more realistic. If I'm not clear I could put a screenshot.
Title: Re: Using a sprite in inventory
Post by: Azrael on June 28, 2009, 08:14:13 AM
I never used a sprite for the inventory but could be the sprite's active point used as top left start point for the item cell?
It's the handle to the top left cell's point?

If so the only way to see the object correctly should be modify the entire inventory (and items) moving it down and making it bigger so the item should be visible entirely.
But i think it should be better, faster and easier to use a simple image instead of the sprite ;)

Otherwise another way could be place the "item" not as a item but as window element. A static control for the image and a button for the active point. Obviously this will cause many other problems, i don't know if it's a valid alternative  ;D
Title: Re: Using a sprite in inventory
Post by: mylesblasonato on June 28, 2009, 01:10:06 PM
Hi there,
In your item definition just use the sprite instead of the png in the filename.
E.G - instead of the following
Code: [Select]
IMAGE = "items\book.bmp"

have the following
Code: [Select]
IMAGE = "items\book.sprite"
Hope that makes sense, if not then please reply. Also in the sprite editor go into properties and tick pixel precise if you want precise collision between items, this makes it easier for combining items and stuff.

Cheers  ::beer
Myles Blasonato.
Title: Re: Using a sprite in inventory
Post by: Catacomber on June 30, 2009, 04:57:17 AM
Thanks for answering Azrael and Myles.

Azrael, it may be easier just to use the png. On the other hand, I could move the image down in the png and make it bigger--

Myles,

I did put

IMAGE = "items\x.sprite"

I will try that pixel precise.  I've been turning it off for some reason. 

Thanks very much.

Title: Re: Using a sprite in inventory
Post by: Mnemonic on July 04, 2009, 08:01:55 AM
You should use a different sprite for the inventory representation and a different sprite for the mouse pointer. And disabling pixel perfect mouse detection for inventory items is indeed a good idea. I hate games with tiny inventory items that are hard to pick with mouse.
Title: Re: Using a sprite in inventory
Post by: Catacomber on July 05, 2009, 08:20:21 AM
Thanks, Mnemonic. I have worked very, very, very hard to make it easy to pick objects with the mouse.  Smooth gameplay, imho, is very important.

But is there a way to disable pixel perfect mouse detection for inventory items that I may have missed?