Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

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

  • #1, by AkcayKaraazmak 11 years ago Zitieren
    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
  • #2, by ke4 11 years ago Zitieren
    I'm not sure if you can change the item image, atleast i didn't find how.
  • #3, by AkcayKaraazmak 11 years ago Zitieren
    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?
  • #4, by sebastian 11 years ago Zitieren
    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

  • #5, by ke4 11 years ago Zitieren
    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
    
  • #6, by sebastian 11 years ago Zitieren
    the image sprite is a field in the objecttable of an item, so i think it can be changed. Its worth a try.
  • #7, by AkcayKaraazmak 11 years ago Zitieren
    Thank you so much mate!! I'l try your ideas, hope I'll make it worksmile
  • #8, by sebastian 11 years ago Zitieren
    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/
  • #9, by sebastian 11 years ago Zitieren
    why does the forum trim doen the mobile links so they doesnt work anymore xD?

    @AkcayKaraazmak Search for " item highlight " in the forum.
  • #10, by AkcayKaraazmak 11 years ago Zitieren
    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 ?
  • #11, by sebastian 11 years ago Zitieren