lionz's Forum Posts

  • Take global setting off the Flip object is the fix. He is following you through each layout including game over and the main menu and is falling off screen.

  • Are you able to share the file? Or more information?

  • Yes if it's predetermined data then you can create and fill out an 'array file' on the right side tool bar and then use the load action to load it into the array so you can read from it during runtime.

  • I really appreciate your time to show me how to create a functional array for inventory use.

    No problem! Array is the way!

    i got it to stop by only allowing the creation if the inventory slot is not overlapping an inventory item object

    That should work if it makes the condition false but be careful since the event is still running constantly. I would add it to the space bar press event myself to create them when inventory is opened and destroy them when inventory is closed, or are you hiding them?

    You will likely come across more bugs but if you understand the array all should be fine :) Maybe as practice you could add a description for each item that shows when you mouse over the inventory slots, descriptions stored in the array too!

  • You can add it to the press space to open inventory event so it triggers once.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One way is to have invslot with single frame animations of all the items with matching names, add the variable for array location like I did with the text object in the example, then you can set invslot animation to array.at(self.ID)

    Another option is to create object by name and every time you open the inventory, for each invslot create the object for invslot.item on top of it. That could work well if you are using a drag and drop approach to swapping items. If you are using arrow keys to select them then I would go for the first option.

  • Ok I had some free time I made this quick one. You can see how it adds items to the array and stacks them, and also how you can remove them.

    dropbox.com/s/7s8b2gx1xq9xl4v/inv%20array.c3p

  • If you put the sprite and box in a 'container', whenever you create the box it will create a sprite with it, then they know and relate to each other. Instead of container you can use other methods like sprite is overlapping box then pin.

  • Use one event, on double tap. With sub event, animation frame = 0, Else animation frame = 1. Make sure you use the system else.

  • It also feels like you have more control if you view it in debug preview. You can see what the array contains and what's changing within it. I just think of the items as a list, X rows at column Y=0, the same as a spreadsheet. Then at the other columns you can add more data like amount at Y=1 etc.

  • I would definitely use arrays, it's so easy. An array is just a list of items and you can see what's going on very easily with what you've collected. You can use simple conditions like when you pick up an item, check if the array contains the item, and add 1 or stack it.

    In my opinion it's more difficult to make an inventory without an array and if you are new with the software you will likely come across bugs that you don't know how to fix. Checking if a certain item is overlapping another item to be able to pick it up etc. This can all be avoided with a simple array.

    Array items are rows, X=0, X=1, X=2. Pick up an item, check if array contains item, if not then push to the back of array. Second column could be amount collected so you can stack. Easily display the array items in your game : give the inventory slots instance variable IDs that relate to the array rows - for each slot set slot.item to array.at(slot.ID).

  • Yes under the object conditions, pick nearest instance. Did you check?

  • A bug of the engine itself hmmm

  • You can add a timer behaviour to an object, perhaps the one with the ability. Then on key pressed start the timer for X seconds. Then on the key press event you can add a condition 'timer is not running', which means key press won't work again until the timer finishes.

  • It'll be something to do with your events but we can't see them. Check that the function is not being called constantly.