[ARRAY] Action -> Save value

0 favourites
  • 12 posts
From the Asset Store
ALL Firebase Support c3 export > WEB > MOBILE > DESKTOP
  • I read the FAQs, I understand partially the arrays, i read the tutorials, but i cant find in the forum a capx example or question of how to save value in an array in a current action over object, please check my events or capx and please teach me how to do this correctly, i want to spawn 2 objects (of value 0 in the array), show some values in text object, save array info, after 2 objects are destroyed then spawn another 2 objects, please check comments in capx .....

    capx

    http://www.filedropper.com/arrayspawnandsetvalues

  • why arrays are so hard :\</p>

  • Your array seems fine. It's your other events that are mixed up. See if this helps. You were loading your array after creating your cubes, due to the Destroy. I've moved the cube off of the layout, and call Spawn directly on startup.

  • Your array seems fine. It's your other events that are mixed up. See if this helps. You were loading your array after creating your cubes, due to the Destroy. I've moved the cube off of the layout, and call Spawn directly on startup.

    http://www.blackhornettechnologies.com/ ... s_BHT.capx

    i am using the debugger to check the array values and the value of color didn't change in the array and the value of the level didn't change correcly in the array when the object its overlapping.

    I am trying to use my logic here and i don't understand why didn't work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I suggest you drop the Array FOR events, and stick to the system FOR loop. You are mixing one and two dimension events, which is confusing things.

    http://www.blackhornettechnologies.com/ ... BHT_b.capx

    Event 8/9 doesn't work because you change the colour to black and then try to find the matching colour, which you just set to black, so it doesn't exist. For 11/12, you are trying to set to CurY but there is no CurY as you are only looping in X.

  • I suggest you drop the Array FOR events, and stick to the system FOR loop. You are mixing one and two dimension events, which is confusing things.

    http://www.blackhornettechnologies.com/ ... BHT_b.capx

    Event 8/9 doesn't work because you change the colour to black and then try to find the matching colour, which you just set to black, so it doesn't exist. For 11/12, you are trying to set to CurY but there is no CurY as you are only looping in X.

    Now its replacing for example the orange value in the entire array not only in the specific object, for example i clicked orange object but didn't click Carrot Object but in the array now the value of carrot color its black, isn't possible to modify the array just picking the object? overlapping -> set value in the object didn't work too.

    If i am overlapping an object or clicking an object i just want that construct2 find in the array the object by name (names are in Y1, for example c2 will find carrot in Y1) and modify a value of the object, for example i clicked a carrot then construct2 will find the carrot object in the array and then will modify the value of the color "orange" to "black", and if for example i am overlapping the object then sum +1 to the level of the object, i am trying to do this in the capx.

  • Just store the loopindex in the redcube when you create it, then you now exactly which X to index.

  • Just store the loopindex in the redcube when you create it, then you now exactly which X to index.

    Now its working ok to replace the color value, however i tried to replicate this with the overlapping object to modify level value but didn't work, the browser events are only useful with mouse clicks?

  • You don't need the For loops now, you have the index already! Post the code again.

  • i tried removing for loops but didn't work <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    http://www.filedropper.com/arrayspawnandsetvaluesbhtc

  • blackhornettechnologies.com/Construct2Stuff/arrayspawnandsetvalues_BHT_d.capx

    Amazing!!, Thank you so much!!!!!!!! , now i understand more the arrays, i need to reread more about loopindex but with this example i understand a lot more.

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