WTF! I'm just trying a simple array!

0 favourites
  • 9 posts
From the Asset Store
Easy to use shop and inventroy populated by an array!
  • Is it just me? Pictures are with a thousand words. I can't figure out why i am not get 5 columns by 7 rows for a total of 35 gems. The debugger is showing 36 (correct original off screen) and its rendering 34,

    Have I been staring at it to long or what?

    [attachment=1:5a5aj96a][/attachment:5a5aj96a]

    Here the debuuger shot, does not make sense.

    [attachment=2:5a5aj96a][/attachment:5a5aj96a]

    An notice that 1 Gem is missing from column 5

    [attachment=3:5a5aj96a][/attachment:5a5aj96a]

    Extra eyes and any help resolving this would be much appreciated.

  • a) you haven't set your array dimensions; the default is 10x1x1, which is what the debugger is showing. b) you are creating a 'gem' at the same time you are referencing it's own width. Try using a fixed width, so you will get an even grid.

  • what blackhornet said. I do this often. Very irritating that I have to manually set the dimensions either via properties or via eventsheet.

  • Yep, this caught me out the first time. You have set your array dimensions first as they don't auto expand.

  • I don't understand how it can be irritating having to set the array dimensions. Do you expect it to know what dimensions you want by magic ;/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't understand how it can be irritating having to set the array dimensions. Do you expect it to know what dimensions you want by magic ;/

    Lol, I develop my array as I go, and forget to increase it's dimensions, and can't access new data.

    I load it via json, and forgot to update the dimensions to reflect new changes - my array is always a work in progress, adding more and more width/height/depth etc... so my changes don't reflect because I failed to update the dimensions. This is what irritates me, "the oversight on my part", wish I could just magically have the numbers appear - lol

    Insurance companies know they can beat my current insurance company, they will even give me a detailed comparision, for free so why can an array not know its own dimensions - (yip just got called again... Argh!)

  • zenox98 it doesn't have to be by magic since it can be derived from when you set the values in the array. However, it doesn't bother me other than it not throwing an error when you're setting a value out of bounds.

  • Often you can use Push/Pop and/or Set Size to manipulate the size of the array. I'm using Push Back in an app I'm currently developing to dynamically increase the size of an array.

  • Thank you all. No its not irritating...I was just starting to get lazy with C2 doing everything for me. I feel like such an idiot! I just thought C2 would read my mind and know the dimensions LOL.

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