Page 1 of 1

Setting XOffset/YOffset at runtime... how?

Posted: Fri Feb 17, 2006 21:54
by synergy
Hey again,

I am busy working on my game's inventory system and have encountered a small (yet significant) roadblock.

I would assume that most people are familiar with standard RPG inventory system functionality. Our version is based on square item icons (32x32) and a one-item-per-inv-slot scheme. As usual, when you click on an item in your inventory, you "pick it up" and the mouse cursor image changes to reflect the in-hand item.

The problem arises when I swap the mouse cursor to the item icon. I want to use the centre of the item icon as the mouse cursor point (instead of the usual top-left corner). Upon some investigation, I noticed that the "target" mouse cursor in the TaharezLook imageset has XOffset and YOffset values to address this idea. I also know that the XOffset and YOffset are properties of an Image object (and are applied every time that particular Image is rendered) -- and this is precisely why the same solution has not worked for me.

Since I am using these item icons as more than a mouse cursor (i.e. the same image needs to rest in a backpack slot, etc.), I need to set the XOffset/YOffset when the item is picked up and re-set it when the item is put back down... but there are no such set methods!

What should I do? Any ideas?

Thanks in advance.

Ryan

Posted: Sat Feb 18, 2006 02:10
by lindquist
You're right. This functionality is actually missing.

For now a workaround would be to delete/recreate the images, only changing the offset each time.

HTH