"Inventory" Problem...

0 favourites
  • 13 posts
  • Hey.

    I've made my own inventory, very basic. It's Drag and Drop or Double Click.

    The thing is, it works as long as the screen is at the same position all the time, in other words, as long as you don't move the character.

    If you move the character so that the screen just goes down a bit, the inventory space that reacts to the dropped item is moved upwards. Can't really explain it but go ahead and try it out:



    Try it:



    You move the character with the WASD keys.

    The tree in the top right corner can be destroyed by clicking on it, and then a tiny tree is spawned, that tree can be dragged to the bottom right "inventory space" as long as the screen is not moved. But try moving the screen a bit down, for example 50px and then try dragging it in to that same spot.. It only works if you drag it to the position that the inventory space used to be in, if you then move the screen back into the top left corner, the inventory space works again with the drag and drop. But the double click works no matter what.

    I have 3 Different Layers:

    • 2 GUI ( Sticks to the screen, where the inventory space is )
    • 1 Stuffs ( Where all the movable objects is )
    • 0 Backtround ( The background... )

    Can anyone help with this particular problem?

    I'll upload the .capx as soon as I figure out how I do it.

  • Anyone? :D

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Have you set the Behavior of your inventory screen to Anchor? Then you can set it in the window where you need it and it will stay (relatively) stable and usable.

  • Nochek Yes, I've tried that and it didn't work. I've played around with all the behaviours and no one fixed the issue. :/

  • On drop, set the little tree sprite to be on layer GUI, it has to be on the same layer as the UI.

  • If you open my file, you can see that when on drop, the TreeIcon moves to Layer 2 if it overlaps the InvSlot1.

    If I also change the other "on drop" action, it changes so that the TreeIcon is allways on GUI and moves within the screen, which is not what I want..

    Am I missing some coding?

    Thanks for the help.

  • I got it to work, it's a bit buggy but I added an action "TreeIcon Is dragging -> Move to Layer 2"

    It works, sort of. But if you got another better solution please tell me.


    Now it cant interact with the fire -.- Because it's on the 2'nd layer as soon as its being dragged...

  • In "Move to Layer 2" replace 2 by "GUI" (caps and the quotes).

    Apparently it works.

    (with your previous capx version, remove your latest changes)

  • Seemed like a good idea, but I can't get it to work. As soon as I move my character the Inventory Slot is not "accepting" the treeicon, but when I move back up into the top left corner, I'm able to drag it into the space again. Don't matter if I have it as "GUI" or "2" :/ Did you manage to make it work in the .capx i posted? If so, can you post the one you edited?

  • A true capx

    Also apparently the version you posted earlier worked as intended by default actualy.

    I don't know what happened on your previous export but it seems corrected.

  • I tried the .capx you posted, and it works as long as the screen doesn't move, as soon as i move my character so that the screen moves, the inventory slot becomes unusable, and that's the issue.

    Man this is a pinch...

  • It works as intended on my computer, even after moving the player.

  • That's really wierd because I tried it in both Mozilla, Chrome and IE and all 3 of them didn't work.

    Do you drag and drop it or do you doubleclick it?

    Thank you for the support.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)