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

  • #1, by joerg-burbachSaturday, 13. May 2017, 12:38 7 years ago
    Hi there!

    I managed to add an inventory which will be displayed when moving the mouse to the top of screen. It will be removed when leaving the area. For this, I used one Mouse Enter and one Mouse leaves command - works, but is not that elegant.

    Now I like to move the Inventory to the bottom, and let it behave like the one from the original Broken Sword (not pop-over from Director's Cut): Fading in all items when entering the area, and fading them out when leaving the area. My screen should not be move up and down either, as the game is fullscreen 1920x1080.

    However, during the last 2 hours, I couldn't invent a method to accomplish that - even with the help of this forum and Google. Either I can't click hot-spots behind the inventory, or the inventory itself does not show up. 

    Thanks for any hint!

    Cheers
    Jörg

    Newbie

    30 Posts


  • #2, by sebastianSaturday, 13. May 2017, 12:51 7 years ago
    i never played the broken sword games. How do they appear exactly? 

    Thread Captain

    2346 Posts

  • #3, by joerg-burbachSaturday, 13. May 2017, 13:00 7 years ago
    Broken Sword uses a small black bar below the screenplay. When you move your mouse cursor over the bottom black bar, all items will fade in. After selecting one with a simple click - or leaving the area with a mouse cursor, the items will fade out again.

    See the image.

    The same - btw - is true for settings, but they are located in a top bar.


    Newbie

    30 Posts

  • #4, by sebastianSaturday, 13. May 2017, 13:11 7 years ago
    unless you want to fade each seperate item delayed a bit in/out (which is not possible to my knowledge) you should be able to do it like this:

    Your inventory (or later settings, etc interfaces) need to have  position:absolute set. The X is set to 0 and the Y coordinate should be set to a value that only one pixel line from the top side of the interface will be seeable (you can make it transparent in the graphic later, but you need something to detect the mouse).

    Create a button in the interface and set it as an "action area". No image needed for that button. The button polygon needs to be covering the 1px area at the top side of the interface (don't have to be that acurat because it only will conroll the slide in)

    In the mouse-enter action of that button add an "execute script" action part and add this:
    Interfaces["inventory"]:to(1000, { InterfaceOffset = {x = 0, y = XXX } })

    where 1000 is the time in ms it takes and XXX should be the Y-position of your interface when visible. "inventory" has to be replaced with the name of your inventory.

    In the INTERFACES "action on leaving" action (in interface properties) execute a script like above but with Y= original position.


    Thread Captain

    2346 Posts

  • #5, by joerg-burbachSaturday, 13. May 2017, 14:33 7 years ago
    Thanks, Sebastian!

    That works great now.

    In my first attempt, I didn not use absolute positioning - but I was not that far away from your solution!

    In Addition, I had to use 5 pixels for the Enter Mouse Thingy to get it to work. I'm working on a Mac.

    Edit: I changed the topic to something more informative - maybe other users need this information and know Broken Sword (Baphomets Fluch in German)

    Newbie

    30 Posts

  • #6, by gabartsSunday, 14. May 2017, 22:00 7 years ago
    I'm really interested in that interface, cause actually I'm creating a Broken Sword type of game, I tought about a fixed inventory in the bottom part of the screen, instead of the fading effect (I mean player can see always items on the bottom black bar). But if you managed to make the fading effect I'm interested smile

    Forum Fan

    137 Posts

  • #7, by joerg-burbachMonday, 15. May 2017, 09:20 7 years ago
    Hey Gabarts,

    atm, I only added sliding of the Inventory in and out, thanks to the great hint by Sebastian.

    For fading, I think, you would need some Lua-Script. For now, I didn't look into Lua that deeply...

    Newbie

    30 Posts

  • #8, by sebastianMonday, 15. May 2017, 10:22 7 years ago
    fading the visibility is doable with nearly the same script as above. just changing the visibility value over time.

    Thread Captain

    2346 Posts

  • #9, by joerg-burbachMonday, 15. May 2017, 10:27 7 years ago
    fading the visibility is doable with nearly the same script as above. just changing the visibility value over time.

    Ah, yes - I already saw that.
    I think, Gabarts meant to fade in the items one after another.

    Newbie

    30 Posts

  • #10, by gabartsMonday, 15. May 2017, 11:11 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...

    Forum Fan

    137 Posts

  • #11, by afrlmeMonday, 15. May 2017, 12:37 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.

    Imperator

    7278 Posts