Need help with the game

So for the inventory i tried to follow this tutorial and make my own version with text

but I’m kind of stuck here

Any ideas on what can i do?

When the object is added, it’s using X() twice. It should probably be X() and Y()

How do i properly center it

After the text object is added and the text is changed, put it at the target center position X()-width/2 , Y()-height/2
It would need to be re-recentered anytime the text was changed.

My test events (the center line is used to set a text of a random length)

Result after clicking each slot:

This does the same thing but using put around

It is still going onto the secound slot while the first one is empty

I don’t see an action like in the video to pick a specific itemBox. The current events picks all of the itemBox objects that are empty (full is false) but in the video it uses pick nearest object. Without that condition all of the empty objects are still picked. I’m guessing all of the ItemBox object variables are also being changed. The picked up item is using the location of the oldest created instance for placement. I’m guessing the first created object instance is the 2nd object in the 1st row. You need to limit it to just one itemBox.

In the video, they used picked nearest object. Unfortunately, you have multiple rows. If you use that technique it would fill the spaces from the point used like 0,0 outward in all directions like the lower quadrant of an expanding circle. It would keep picking the empty object closest to 0,0.

I would test your events by adding the pick nearest object using 0,0 or the X, Y of the object in the first position. That will at least verify if what I think is happening is happening and test the rest of the events.

I would look for a tutorial or example that uses a grid setup instead of a single row. The 2 styles are extremely similar except for the method of picking the empty spaces.

There’s also a slot based inventory extension. That might simplify help.

I’m not sure of the best way to pick empty grid spaces. Let’s first confirm the issue and then maybe you can go from there.

(my game resolution is 640x480) is it possible to mix the slot extension with the code

I’m not too familiar with the slot behavior but it uses the objects that you create. So, the number of slots, size and scene size shouldn’t matter.

maybe someone elso could help. if not though, i will look for a different way to make the inventory

What I would say is to try boolean variables to check if the slot is full so let’s say slot 1 and 2 is full it would but it in slot 3 then change to boolean variable now if you use the item from slot 1 it should then put the new item in slot 1 kinda like minecraft

but all my slots are the same object

OK what I am saying is that you make a boolean variable for each slot that is set to false then you have it so when you get an item the game will check if the slot is full if it is it will put it in the next slot and it does not matter if it is the same object you just need to set the position of it to a different slot if it sounds complicated let me know and I will show you the code needed and what I lt does

i feel like i done this before but it is still like this. this just sounds complicated

OK I will send a picture

where is the picture?

Got busy and forgot sorry I will send it as soon as I can

hi hope you’re doing great. dont forget about sending me the pic

1 Like

hope your job is doing good. don’t forget about the pic

Don’t forget about the pic. Hope you’ll make a successful game

1 Like

don’t forget about the pic