How do I load data to an array to spawn an object

Get help using Construct 2

Post » Mon Feb 27, 2017 2:49 am

so I have text that is like this

1 250 8
2 240 6
3 230 5
4 220 9
5 224 4

the first number means its order, the second is the x value, and the third is the y value.
how do I load this data to an array so I can spawn #1 at x 250 y 8 or #2 at x 240 y 6

should i make it into xml?
Code: Select all

but how do i load it into an array, to spawn the objects, or is that even necessary?
Posts: 1
Reputation: 277

Post » Mon Feb 27, 2017 10:58 am

At this moment, both are fine to use.
XML has that one benefit, it is easy to edit outside C2.

At a point in the nearly future (c3), Arrays will have their own 'value editor'. That will make things a LOT nicer. And bring the preference to using an array, i think.

If you choose for XML, there are a lot of tuts to help you.
There is also a template (when you make a new project, type XML in the search line)

If you choose for an array. Then specific for your question ....
You dont need the 'order', because the 'order' is already the same as the index on the X axis.
Far more easy is to start with an empty array, as in this example. ... .capx?dl=0

As you see, at this point is constructing the array tedious. If you have a lot to create, you are better of using XML.
But, that will change in the near future. And i am (personalty) very happy the new array editor.
Posts: 2,493
Reputation: 21,450

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests