How do I initialise an array and display its contents?

Just started using Construct 2? Post your questions here

Post » Sun Oct 18, 2015 5:22 am

I've been trying and searching for about an hour - I'd like to initialise a one dimensional array (at creation of the scene) to have a value of -1 in each variable. But the actions after 'on start of layout' don't seem to include the capacity to have a for loop to do this?

So how can I set the value of each array variable? I'm guessing construct is quite capable of doing this (as all programming languages are!), but how it wants me to tell it to do it full on eludes me!

Also I want to show them on the screen - I'm guessing I'll use something like the shooter tutorials method, but any hints appreciated.

In the end I'm using the array to represent days, each variable is a day and has the growth (in percentage) of a particular group of plants.

Thanks for any help you can give!
B
50
S
14
G
4
Posts: 189
Reputation: 5,508

Post » Sun Oct 18, 2015 8:54 am

I'm amazed that though I've done the top down shooter and the score text works in that for me, in a new project I've just tried to change a text to something else AND the code looks exactly the same and...it doesn't work???

Every tick, set text to "Changed"

Run it, just get "Text"!

What the...!?
B
50
S
14
G
4
Posts: 189
Reputation: 5,508

Post » Tue Nov 17, 2015 4:04 pm

You can attach your .capx so we can take a look and more easily find the problem instead of guessing the problem
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Thu Nov 19, 2015 10:00 am

IIRC I'd started a new event sheet and at that point was unaware of having to include it in the first event sheet attached to the scene. So the commands on that event sheet did nothing. Thanks for the reply, regardless :)
B
50
S
14
G
4
Posts: 189
Reputation: 5,508


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests