How Do I Fill This Array

  • So I'm pretty sure that there is either something wrong with my code, or the Width and Height are swapped around in the C2 Engine.

    I want to populate an array that is 8x5x1 with random numbers. The code looks good to me, but you can see in the debugger it is not the case. It seems to execute the first 5 right, then goes to the next Y and continue from the previous X position.

    If anyone can help, it would be greatly appreciated.

    LINK

  • I would do this the other way around:

    Why do you need this array anyway? You have a bunch of text instances, create an instance variable and fill it with random values.

    I'm saying this in every post - arrays in C2/C3 are overrated. Most tasks that people are trying to do with arrays, can be done easier with instance variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why do you need this array anyway?

    It was in an attempt to make a deck of cards that could be shuffled, but I was doing the basics of just getting it to fill with meaningless random numbers first. I had used arrays for more important things, but thought I'd try this for something new, and always happy to hear of better ways to do things.

  • Here is an example of shuffling and dealing a deck of cards I did for another post (without the arrays!)

    https://www.dropbox.com/s/b7qmdni2wn9ze ... .capx?dl=0

    You'll need Rex's addon MoveTo to open it.

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