fanadventures.net

Header
English
 
Forum overview > Changing the image of the inventory item when it comes over a scene object?
  • Changing the image of the inventory item when it comes over a scene object?

    by AkcayKaraazmak · Thursday, 20. August 2015, 16:41 h ~ 2 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
    AkcayKaraazmak
  • by ke4 · Thursday, 20. August 2015, 18:00 h ~ 2 years ago
    I'm not sure if you can change the item image, atleast i didn't find how.
    ke4
  • by AkcayKaraazmak · Thursday, 20. August 2015, 18:03 h ~ 2 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?
    AkcayKaraazmak
  • by sebastian · Thursday, 20. August 2015, 18:11 h ~ 2 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

    sebastian
  • by ke4 · Thursday, 20. August 2015, 18:11 h ~ 2 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

    1
    2
    3
    4
    5
    6
    ke4
  • by sebastian · Thursday, 20. August 2015, 18:25 h ~ 2 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.
    sebastian
  • by AkcayKaraazmak · Thursday, 20. August 2015, 20:12 h ~ 2 years ago
    Thank you so much mate!! I'l try your ideas, hope I'll make it worksmile
    AkcayKaraazmak
  • by sebastian · Thursday, 20. August 2015, 20:19 h ~ 2 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/thr...
    sebastian
  • by sebastian · Thursday, 20. August 2015, 20:20 h ~ 2 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.
    sebastian
  • by AkcayKaraazmak · Thursday, 20. August 2015, 20:38 h ~ 2 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 ?
    AkcayKaraazmak
  • by sebastian · Thursday, 20. August 2015, 21:06 h ~ 2 years ago
    sebastian
  • New post