Changing the image of the inventory item when it comes over a scene object?

  • #1, by AkcayKaraazmakThursday, 20. August 2015, 16:41 10 years ago
    Hi there,

    How I can change the image of the selected item when it comes over a scene object? For example, I click the item "key" from inventory and move it over the door object in the scene. And when the cursor (item key) on the door object, I want to change the image of the item key, so user can understand key can be used on the door.

    Thank you smile

    Great Poster

    440 Posts


  • #2, by ke4Thursday, 20. August 2015, 18:00 10 years ago
    I'm not sure if you can change the item image, atleast i didn't find how.

    Key Killer

    810 Posts

  • #3, by AkcayKaraazmakThursday, 20. August 2015, 18:03 10 years ago
    So mate, what u do for this situation? You take the item and how u make it understandable that, it can be used on that object?

    Great Poster

    440 Posts

  • #4, by sebastianThursday, 20. August 2015, 18:11 10 years ago
    normally via the actiontext you can tell the player thatvthere is an Object.
    Nevertheless it would be cool to have a colored border (image) around that item when it hovers interactable objects or other items.
    I think that could be done in 2 ways:
    1. Make 2 items for each item and change the item when it hovers an object to the other and the other way around. I think this is a solution even if it is very hard to implement.
    2. Changing the Items sprite Image via Lua when it hovers objects and thr other way around.
    3. Use an animation for each item and try to switch it to a second one when hovering an object. Maybe also doablenwith lua

    Thread Captain

    2346 Posts

  • #5, by ke4Thursday, 20. August 2015, 18:11 10 years ago
    Well i don't do anything in that case... grin
    You can detect if some item is held and if so then check the item name.
    So i guess the workaround would be to have 2 versions for each item active & not active and on the hover you would set the active item as held and on the cursor leaves the normal again.
    But it's so much additional work.. but maybe some function could handle that.

    This is what i tried but it doesn't do anything

    local itm = game.GameUsedItem:getName()
    
    if itm ~= "" then
    local obj = getObject("Objects[" .. itm .. "]")
    obj.ObjectSprite.SpriteSprite = {"path", "0", "0", {"0", "0"}}
    end
    

    Key Killer

    810 Posts

  • #6, by sebastianThursday, 20. August 2015, 18:25 10 years ago
    the image sprite is a field in the objecttable of an item, so i think it can be changed. Its worth a try.

    Thread Captain

    2346 Posts

  • #7, by AkcayKaraazmakThursday, 20. August 2015, 20:12 10 years ago
    Thank you so much mate!! I'l try your ideas, hope I'll make it worksmile

    Great Poster

    440 Posts

  • #8, by sebastianThursday, 20. August 2015, 20:19 10 years ago
    im not at home right now but i found this with the mobile version of the forum:
    http://www.visionaire-studio.net/mobile/#forum/thread/25374/1/

    Thread Captain

    2346 Posts

  • #9, by sebastianThursday, 20. August 2015, 20:20 10 years ago
    why does the forum trim doen the mobile links so they doesnt work anymore xD?

    @AkcayKaraazmak Search for " item highlight " in the forum.

    Thread Captain

    2346 Posts

  • #10, by AkcayKaraazmakThursday, 20. August 2015, 20:38 10 years ago
    Thhank you bro! I cant see anything on that page something related with item highlight :\ Isnt the page is http://www.visionaire-studio.net/mobile ?

    Great Poster

    440 Posts

  • #11, by sebastianThursday, 20. August 2015, 21:06 10 years ago

    Thread Captain

    2346 Posts