How do I insert multiple values into one Array position?

Get help using Construct 2

Post » Wed Dec 02, 2015 8:20 am

Hi,

Is it possible to put multiple values into one Array(1D) position? If so can you help?

I have an Array that everytime in my game I make an object (For example: a bed) i add an extra X index. What I'm looking for is if it's possible to store multiple values on the same index. For example: X position as integer, Y position as integer, health etc.etc. so when I search the Array i'm able to get the positions for the beds on the map and can quickly set my AI to pathfind towards it.






L
B
14
S
5
G
1
Posts: 32
Reputation: 1,038

Post » Wed Dec 02, 2015 10:27 am

In my opinion that kinda defeats the purpose of the array object..

Array has x and y -direction (and even z if needed)
Which you can take advantage of..

if you just wat to put all the information in a string, using the dictionary object might be a better option...
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Dec 02, 2015 10:36 am

as @LittleStain already said..

you can use two dimensional array..
instead of a single cell,you can add one column..

Image

Example.capx
B
66
S
24
G
7
Posts: 1,515
Reputation: 11,041

Post » Wed Dec 02, 2015 11:29 am

Thank you for both replies.

@korbaach

Thanks, I will use this if I don't find any other solution. I don't know why I didn't think of that in the first place ^^.
B
14
S
5
G
1
Posts: 32
Reputation: 1,038


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 46 guests