[Quick Tip] Using a cursor instead of a crosshair inventory items hotspot marker

Started by veggie_89, Wed 15/08/2012 03:35:06

Previous topic - Next topic

veggie_89

Here's a quick tip for those searching how to use a cursor graphic instead of a cross-hair graphic to represent the hot-spot maker when using an inventory item.
To use a graphic to represent the hotspot of the inventory item cursor, go to General Settings>Inventory>Inventory Item cursor hotspot marker and set it to: Use Crosshair Sprite.

The problem is, it will use the middle pixel of the sprite because it is designed for a crosshair sprite and not a cursor sprite. So far I have not found a way to tell it to use the top left pixel, but I did figure out this work around which seems to work well enough:

1. Open your cursor graphic in your image editing software.
2. Double the width and height of your canvas and move your cursor into the lower right quadrant of your image:
--------------------
|          |         |
|          |         |
|          |         |
--------------------
|          || \      |
|          ||__\   |
|          |   \     |
--------------------
Now the center of your image is the top left pixel of your cursor. Problem solved. Hope this helps. :) :grin:

P.S. If someone knows a way to set the hotspot to use the top left pixel of the cursor sprite, by all means,let me know.
- Reggie

Ghost

I'm not sure if I read your post correctly, but what you describe sounds like a (complicated yet functional) workaround.

When you use a crosshair sprite, the top left corner will be placed where your inventory item's hotspot is- setting it to 0,0 (in the inventory item properties) will draw the crosshair sprite's top left pixel-position exactly there.

veggie_89

Quote from: Ghost on Wed 15/08/2012 03:58:22
When you use a crosshair sprite, the top left corner will be placed where your inventory item's hotspot is.

This is not the case in v3.2.1 using the default game template. The center of the sprite is placed at the inventory items hotspotX and hotspotY coordinates. This works well for a crosshair:
    |
---o---
    |

But not for a cursor:

|\
|  \
| o \
------
    \
      \

Try it for yourself. :smiley:
- Reggie

Andail

I could be misunderstanding this issue... but in the inventory window, there's an option to use a sprite for the inventory cursor. Surely you can just use your arrow cursor sprite here, and set the hotspot exactly where you want it (by clicking in the sprite frame).
How does this not very easily solve the problem you're describing?

Khris

Game designers might want to add a visible hotspot marker to their eModeUseinv cursor for extra precision. This can be done by AGS automatically (in which case a crosshair is drawn at the hotspot of the cursor). Alternatively, one can use a custom sprite. This sprite's position in relation to the cursor hotspot can not be changed; the sprite is always centered (since AGS assumes that the game designer will still use some sort of crosshair).

Thus, veggie_89's tip was: if the supposed hotspot of the hotspot marker isn't in the sprite's center, add borders to the sprite until it is.
I can confirm this for 3.2.1.

Also, the cursor sprite doesn't get extended if the hotspot marker only overlaps part of it. Thus make sure that there's a big enough area around the inv items hotspot to hold the entire marker. If necessary, increase the inv item sprite's canvas to prevent part of the marker from being cut off.

SMF spam blocked by CleanTalk