How do I use arrays?

Get help using Construct 2

Post » Wed Aug 26, 2015 2:49 pm

I'm trying to make a snake game and there's this forum post saying use arrays and had a link to the manual, I read the manual section on arrays but its all very confusing to me, how do I use arrays (in general not just with a snake game)? How would it work with a Snake game exactly...?
B
4
Posts: 1
Reputation: 208

Post » Wed Aug 26, 2015 2:59 pm

You can use two-dimensional arrays to track the locations of the all of the snake's body parts, saying you have a part at {1,1} and another part at {1,2} and the next part at {1,3} and a tail at {2,3}.

So you would just fill your two-dimensional array with 1s and 0s; 1 meaning snake body, 0 meaning no snake body.

Like this:
Image
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822


Return to How do I....?

Who is online

Users browsing this forum: jkmalau, MoscowModder, terence951, vegapomme27 and 9 guests