Arrays in C2 - Question about the indexes

Discussion and feedback on Construct 2

Post » Tue Jan 27, 2015 3:45 pm

Hi,

i want to create a 2d map with the miner method. For this is use arrays and "miners" that dig in random directions. My question is, if a miner moves to a position that is outside the array [example: map(-1,3)] will this just be ignored? Or can this result in problems, if i try to access an index, that does not exist (or was not defined before) in the array?
I hope my question is clear, as i am not a native speaker.
B
11
S
2
Posts: 213
Reputation: 1,266

Post » Tue Jan 27, 2015 5:15 pm

outside of the array, the value is 0 no matter what. No crashes or anything, you will just read 0 and if you change it, nothing will happen, still 0.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
54
S
22
G
18
Posts: 2,123
Reputation: 17,150

Post » Tue Jan 27, 2015 5:25 pm

thanks for the reply! this is exactly what i wanted to know. :)
B
11
S
2
Posts: 213
Reputation: 1,266


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests