[Solved] Hotbar/inventory system

I don’t have a problem with looping, it was just another one of my mistakes in another line of programming.

I’m just having trouble making a projectile curved, which I’ve already posted about

1 Like

Now he’s having problems with the system again.
It’s the same programming as the previous print

The card is placed as if it were in another slot, but it is not in the other slot, but on top of the previous slot

Can you post the current relavent events.

Currently, I’ve put this part to change layers because the slots are in the HUD.
I tried a lot of things and it didn’t work.
I even thought about using ID variables to see if it would work, but I have no idea

It looks like when the card is put into a slot, it makes the next event group true. So, it immediately puts the card back to the x, y. It’s a common thing . I usually use a scene boolean named changed to track whether the first event is triggered.

On the first dot add set changed to false
2nd dot set changed to true
3rd dot add the condition changed is false

Same result.

Which part isn’t working? Does the initial move to the slot work? I’m not sure where the card is supposed to go on the 2nd click. Where is x, y.?

Edit: going back in the thread, I see x, y is the last position. Unless you’re setting it somewhere else, set x and set y to the current position needs to be added like in zutty’s example.

So the part that isn’t working is the fact that the card is on top of the last one that was chosen.
Example: I chose a card, it went to the slot object, but the next one I choose, it goes to the slot, but instead of going to the next slot, it goes to the same one I chose from the previous card!

The problem is not the coordinates, since the first click is always for the card to go to the slot and the other click is for the card to return to its original position.

I still think the events might conflict. Let’s simplify things and use a toogle instead.

try me:

I added a pick nearest to the card as well to prevent 2 cards from be slected at the same time.

Well, I’ll send you the project.
I replicated exactly the same code and it got worse.
And I’ve tried to see if there’s any other line of code that messes with the inventory too, but from what I’ve seen there isn’t.

I’m going crazy with programming, I’ve just tried it for the first time. And it worked, now that I’ve restarted the game, it no longer works as it should. INCREDIBLE

It seems to work now, but I have to click twice for the letter to actually go

I’ll have a look shortly.

It works for me. Make sure you preview it from the projects main scene tab. You can also set a scene as the default start scene.


From what I’ve seen, the bug happens after 2 times of using the inventory. And yes, I already have the last option activated and with the scene set as default.
Have you tested the system more than once?

I see it happening. IDKW. I’ll test some more.

Okay, thanks for your help. For now I’ll try to focus on the rest of the game!

I think it happens if you try to add a card when there’s no open slot.

IDK, I find it strange that this happens right at the start of the cards even though there’s space in the slots

If the slots are full and another card is clicked, it still toggles the card boolean placed. So, it won’t move until you click and toggle it again.

I believe this works


If the card is not placed then check for a slot
If the card isn’t checked then pick all the slots because the previous slot is false condition picks only the false objects. So, they all need to be picked.

Like this? I’ve tried, but only one card goes.