Problem with array

0 favourites
  • 8 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • Hi all.

    Thank you for your web and works.

    I'm working in a little tale, and I have problems for show the texts.

    First, I do

    an array: Tales

    and Text: TextTales

    event sheet

    System On start of layout:

    1) Define size of Tales:

    Tales = Set size to (10, 1, 0)

    (10 will be the texts, for sample)

    2) Define value or Tales

    Tales: Set value at(1,1) to ?text 1"

    Tales: Set value at(1,2) to ?text 2"

    Tales: Set value at(1,3) to ?text 3"

    ...

    and ending,

    3) I initialize the TextTales with Tales data.

    TextTales: Set text to Tales.At(1,1)

    but when I execute the app,

    TextTales = 0

    Do you can help me, please?

    suggestion?

    Thank!!

  • Hey Marcos Trivino,

    Remember arrays are based off of zero. So if you are creating an array (10,1,0) then it should look like this

    0,0

    1,0

    2,0

    3,0

    4,0...9,0

    I put a quick example together to show you. Conversation Array

    Also check out Kyatric Array examples in the array section of FAQ

    Concrete commented example of use of arrays and A miniRPG example using array are great. FAQ

    Hope this helps

  • A point to note from the fabulous manual:

    "A simple example of a list of ten values would be a 10 x 1 x 1 array. Note that you should not set a size of 0 on any of the dimensions else the entire array becomes empty; it is correct to have a size of 1 on unused dimensions."

  • Hi all,

    Well, I changed the array index for your recommendation, and nothing.

    Then I wrote the entire project step by step, and I haven?t errors. ??

    (The index starts in 0,0)

    I think that the problem was the drag and drop an object of other project.

    I tested this idea this morning and my editor closed.

    Reopened the project and the editor send me an error message.

    I push ?ignore? (or similar) button.

    Delette the object

    And I can continue working OK.   

    The sprites, all OK.

    and now I will do the buttons with background graphics.

    PS.:   shadowedsol, I can't open your sample, because you use the ver 83 and I have 82. ( the downloadable free version "Construct 2 r80.2") But thanks, I was very confused trying values, and I not remembered what index starts 0.0.

    PS2: Danijerry, thx for your link.

    How I can open the files .cap? There are many interesting examples.

    Thx for your time XD

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a screenshot of the array since you can't open it.

    <img src="http://dl.dropbox.com/u/5773521/convarray.jpg" border="0">

    Thanks Danijerry for the correction, I forgot about that.

    Cap are opened with the old Construct

  • Hi all,

    I leave you this link which shows how to make a 3-state button.

    I modified an example of Kyatric (thx Kyatric)

    fileserve.com/file/VaeqNTM/button3states.7z

    suggestions?

    Bye!!

  • Question: do can you base an if statement off of the length of an array?

    dumb question, but its early, and i happend to be reading the forum, so if its dumb and explained elsewhere i dont care :P

  • Yes you can create an Event that reads multiple array values (length?) and then runs an action. Hope that is what you meant by length, but you can pretty much get anything you want out of an array.

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