problem with array

Get help using Construct 2

Post » Wed Oct 19, 2016 5:00 pm

i have a problem with array, this is what i have
Image
*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
Image
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
B
8
S
2
Posts: 15
Reputation: 530

Post » Wed Oct 19, 2016 10:26 pm

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'.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Oct 20, 2016 1:41 am

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?
B
8
S
2
Posts: 15
Reputation: 530

Post » Thu Oct 20, 2016 11:41 am

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Oct 20, 2016 1:51 pm

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
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Oct 20, 2016 3:12 pm

Tbanks for your help, i found what I'm looking for
B
8
S
2
Posts: 15
Reputation: 530


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests