Inventory showing up on Mouse Entering Area (like Broken Sword classic)

  • #10, z afrlmeMonday, 15. May 2017, 12:37 hodinky 7 years ago
    Don't make things too complex smile simple fading for all items is nice, even without fading... cause if you start to add some fading in and there then you must insert some fx in other menu etc... that in out inventory at bottom over a black bar works...
    Fading them one at a time would be hard as I don't think you can control the opacity of buttons or items; only scene objects, characters & interfaces in general.

    However, you could if you are using a black bar, maybe use the new Lua draw function thing to cover up where each slot is & have it fade out over time. Actually, just remembered something.... pretty sure Simon added some new masking thing? Maybe could have it transition downwards or to the right so that an image that's covering up starts fading out from left to right in a sort of gradient. I don't know if it's possible though & I've not seen any script examples for it.

    Imperátor

    7285 Posts


  • #11, z ke4Monday, 15. May 2017, 14:34 hodinky 7 years ago
    Would be possible with animations for your items & controling the currently played frames.
    Let's say you have for eash item a 10 frames animation ( fading in )
    Frame 1 - nothing visible, frame 10 - all visible

    On opening the interface you would animate the items one by one. As default they would all have both first and last frame set to the 1 frame.

    Then you would animate first item by setting first frame to 1 and last frame to 10. The 10th frame itself would be containing a cript which would be setting the first frame to 10 and also the last frame to 10.

    This script would also have to check the items table if this item is the last one or not. If not you start animating the next one.

    On hiding the interface you would set all the items back to first 1, last 1 frame.

    currentItem = 1
    
    if #(game.CurrentCharacter.Items) > 0 then
        ActiveAnimations[items[currentItem]:getName()].AnimationfirstFrame = 1
        ActiveAnimations[items[currentItem]:getName()].AnimationLastFrame = 10
    end

    10th frame action:

    ActiveAnimations[items[currentItem]:getName()].AnimationfirstFrame = 1
    0
    ActiveAnimations[items[currentItem]:getName()].AnimationLastFrame = 10
    if #(game.CurrentCharacter.Items) > currentItem then
        currentItem = currentItem + 1
        ActiveAnimations[items[currentItem]:getName()].AnimationfirstFrame = 1
    
        ActiveAnimations[items[currentItem]:getName()].AnimationLastFrame = 10
    else
        currentItem = 1
    end

    You could also use the worflow function to get the code shorter & nicer.

    function setAnimFrames(ani, n1, n2)
    
        ActiveAnimations[ani].AnimationFirstFrame = n1
        ActiveAnimations[ani].AnimationLastFrame = n2
    end

    setAnimFrames(game.CurrentCharacter.Items[currentItem]:getName(), 1, 1)

    Hiding the interface:
    for i =1, #game.CurrentCharacter.Items do
        setAnimFrames(game.CurrentCharacter.Items[i]:getName(), 1, 1)
    end

    Untested, just a thought. If you could animate the mask that would be the easier solution.

    Edit: Maybe you could also ( if the interface is a black bar ) use a black tile animations put over the items itself. Let's say 10 slots = 10 animations. You would just play the first animation and each of the animation on the last frame would triggers the next one.  Or even one big animation block including all the chunks. Just played once on the opening.

    Zabiják klíčů

    810 Posts

  • #12, z sebastianMonday, 15. May 2017, 15:03 hodinky 7 years ago
    haha, ke4, youre a genius! one big animation which reveals the items by moving to the right or animating a fade in fore each slot would do the trick without much work.


    Kapitán

    2346 Posts

  • #13, z afrlmeMonday, 15. May 2017, 17:35 hodinky 7 years ago
    haha, ke4, youre a genius! one big animation which reveals the items by moving to the right or animating a fade in fore each slot would do the trick without much work.



    It's a shame we can't control the opacity of buttons & animations.

    Imperátor

    7285 Posts

  • #14, z gabartsMonday, 15. May 2017, 21:54 hodinky 7 years ago
    Yes, some flash functions would make the interface part perfect. With graphic tricks you can do lot of workarounds, I think until graphic or animations don't block some code, you can experiment in many ways.

    Fanoušek fóra

    137 Posts