Hi!
I'm fairly new to the AGS editor, and have now experienced my first problem that I hope someone knows the answer of.
I've created an object with an inventory sprite, but in-game, the cursor doesn't seem to detect the whole sprite (see images for reference).
(http://i.imgur.com/cCeG18B.png)
(http://i.imgur.com/rgXu6be.png)
I have the exact same width and height as the default template sprites (31 x 23), and I believe all my scripting is in order.
For your information, I've made the sprite in Piskel (http://www.piskelapp.com/), and I created it in the 31 x 23 size.
As a side note, I also have a problem with my character when I click to walk somewhere. He never goes exactly to the spot I clicked with the cursor. He always stands a little bit above the place I clicked. I did use the crop function already, so there is no obsessive space left in my sprites. Could this be linked to the above problem?
I'm saving all my sprites as .png and crop them (inside the AGS) before using.
Does anybody know the problem here? Would be greatly appreciated if anyone could help me out! :)
1. Have you set the cursor hotspot to the center of the cross? (Under "Cursors," click on the cursor mode to see the sprite, there's a little crosshair that shows the "click point" of the cursor. You can adjust it in the properties pane.)
2. If that doesn't help with the character positioning, it could be that the apparent point the character is standing on is still a few pixels above the bottom edge of the sprite (this is normal if some frames extend further down, for example in the down walkcycle). In that case, you can adjust the Character.z value. Set it to -4, for example, and the character sprite should shift down 4 pixels without changing the character's x,y coordinates (for purposes of scaling, walkbehinds etc.).
It's been too long since I've dealt with inventory items to help you with that if point 1 doesn't work, I'm afraid.
Quote from: Snarky on Tue 17/03/2015 18:35:55
1. Have you set the cursor hotspot to the center of the cross? (Under "Cursors," click on the cursor mode to see the sprite, there's a little crosshair that shows the "click point" of the cursor. You can adjust it in the properties pane.)
2. If that doesn't help with the character positioning, it could be that the apparent point the character is standing on is still a few pixels above the bottom edge of the sprite (this is normal if some frames extend further down, for example in the down walkcycle). In that case, you can adjust the Character.z value. Set it to -4, for example, and the character sprite should shift down 4 pixels without changing the character's x,y coordinates (for purposes of scaling, walkbehinds etc.).
It's been too long since I've dealt with inventory items to help you with that if point 1 doesn't work, I'm afraid.
Hi!
Thanks for the quick answer.
Indeed, that fixed the walking issues! Thanks! The HotspotX/Y was set to 7 x 7 when it seems I need to use 15 x 15. Although, the inventory issue persists for some reason...
Oh, I think I remember now. There's something with inventory item size that needs to be set to the right dimensions. Essentially, there's an invisible button in the top left of the slot that is the actual inventory item, and the graphic is just spilling over (AGS doesn't tend to crop graphics to the edges of buttons and things if they're too big). Have you tried having more than one inventory item? I seem to remember that you might find they overlap instead of aligning correctly, because the actual item is much smaller than it looks. Have a look at your inventory gui (it's its own node in the project tree).
The InvWindow.ItemHeight and InvWindow.ItemWidth properties can also be changed in the script IIRC, so if it looks right in the editor, try searching for any usages of those properties in your scripts.
Hi again!
Thank you so much guys, it has all been fixed now! If anyone else have the same problem, here's what I did:
Click on GUIs -> gMaingui.
Select the inventory area.
In the properties pane, look for "ItemHeight" and "ItemWidth". Mine was set to 24 x 32. I had to change it to 48 x 64 in order for my inventory sprites to work correctly!
Again, thank you so much!