Inventory on the top

  • #1, by JorkzSunday, 05. June 2016, 16:02 8 years ago
    Hello.
    I want to create a top inventory, similar to the "Locked Out" game / template.(transparent and dropdown menu)
    How to do that ? I think it's an offset problem... I don't understand how this offset notion works

    Someone can shed light on this ?

    Newbie

    90 Posts


  • #2, by afrlmeSunday, 05. June 2016, 16:17 8 years ago
    You mean the inventory is hidden by default & slides in when you move the mouse near it? I assume the person that made that game probably used one of my sliding interface Lua scripts. I highly recommend you try to get used to the basics of the engine before you delve into the scripting side of things.

    & just in case you want to dive into the deep end first... grin
    function mouseEvt(typ, pos)
     if typ == eEvtMouseMove then
       if game.CurrentScene:getName() == game.CurrentCharacter.Scene:getName() then 
        if getCursorPos().y < 50 and Interfaces["inventory"].InterfaceOffset.y == -100 then
         Interfaces["inventory"]:to(300, {  InterfaceOffset = {x = 0, y = 0} }, easeQuintOut)
        elseif getCursorPos().y > 100 and Interfaces["inventory"].InterfaceOffset.y == 0 then
          Interfaces["inventory"]:to(300, {  InterfaceOffset = {x = 0, y = -100} }, easeQuintIn)
        end
       end
     end
    end
    
    registerEventHandler("mouseEvent", "mouseEvt")
    


    Quick note: the script is not plug & play. You need to edit it to suit your needs, by changing the interface name values & the offset values.

    P.S: here's the last script I wrote for sliding interfaces. Be warned though, it contains a fair bit of code as I wrote it before we had shorthand Lua access. Also it's an advanced script - it's fairly complicated; especially if you compare it to the example I mocked up (in the code box above).

    Imperator

    7278 Posts

  • #3, by JorkzThursday, 09. June 2016, 11:26 8 years ago
    thanks

    Newbie

    90 Posts