problem with array

0 favourites
  • 6 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • i have a problem with array, this is what i have

    *repeated 6 times

    what i want to do, is when a specific object is overlaping a specific cell, the the cell becomes the value of the object superimposed on it, and when the object is removed, the cell is empty

    but this is what happend

    the behavior is weird because not always the cells become all "masterball" sometimes the cells become 2 differents values, but never is what i want

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In general.

    This is absolutely weird coding. Adding something to the array should be done once, and on the moment you add something to a cell. The same goes for removing. Now you add something to the array each tick. Because 'is overlapping condition' is true every tick that there is something on that cell. On the other hand 'is not overlapping' is true every tick that there is not something above the cell.

    This kind of stuff, checking overlaps every tick, will slowwww dowwnnnnn your game to the extreme.

    There should be no new code block for each cell. This is easily done with 1 code block for all cells, because they are instances comparing to 1 family.

    Specific.

    Event 4.

    Items is overlapping casilla. This is a pick condition. A pick condition makes a list of all instances/objects that meet the condition. Lets call this list the picklist. Now, 'Items is overlapping casilla' picks all items, every single member of the family items that overlaps with any casilla. At this moment the picklist contains all items and all casilla.

    'celda = 1" keeps from that picklist those cassila with celda = 1. Now the picklist contains ALL items and ONE casilla. The actions will run on this picklist.

    So if you use items.tipo in an action, which items will it use ? You did not specify an items. You feed all items to that action and expect C2 to gamble wich items it should use for items.tipo.

    Sorry if i sound harsh. I already apologise.

    But you should follow a few more tutorials about using 'instances' and 'familys'.

  • LOL, in my mind was perfect xd, this is my first project, what i want is a inventory system, where you can drag items from the inventory to the kickbar, and use them in the game. So, basically all my code is wrong, where i can learn how to do the inventory system?

  • But, say you want to drop items from one place to another, while updating an array, and account for a user dropping items everywhere :

    https://drive.google.com/open?id=0B1SSu ... 1IxcXVodkk

  • Tbanks for your help, i found what I'm looking for

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