help with arrays and the choose command

Get help using Construct 2

Post » Tue Aug 22, 2017 12:37 am

ok i am making a semi 3d flight sim game i start with 3 runways and another load of them you have to find.
Each runway has passengers and mail that has to go to another runway so if you are at runway 2 you get passengers and mail to go to runway 1and 3 only
i have made and array where 1 is 1 2 is 2 and 3 is 3 so when i run into a runway say number 8 i push 8 on the end of the array giving me a choice of 1 2 3 or 8



now the problem is when i start finding more runways and the passenger choices become more. Because when i make the choose (array.at(1),(array.at(3),(array.at(8)

its fine but i am up to six runways and its getting a bit of a pain to start telling the program if at runway 8 and array at 8 is 8 then it cant use it this starts getting complex over all the runways so i was wondering if anyone has an idea of how to make this a less time consuming pain in the but thing too do

THANKS IN ADVANCE
B
8
S
2
Posts: 21
Reputation: 1,327

Post » Tue Aug 22, 2017 12:47 am

just to add to this to make it a bit easier to get what i mean

heres the array example

0 0
1 1
2 2
3 3 all these are set at start then i start the push as runways are found
4 6 found runway 6
5 5 found 5
6 7 found 7

if i am at runway 6 i cant use the array at 1 and 2 and 3 and 4 and 5 and 6 and 7 because aaray 4 is 6 so i dont want 6 at 6

i hace got around this by using if array at 4 is 6 then use 1 2 3 5 6 7 and as you fine the runways in no order array 7 could be the 6

i hope this makes it clearer as to what i am trying to do
B
8
S
2
Posts: 21
Reputation: 1,327

Post » Tue Aug 22, 2017 9:08 am

All I can say is WTF is going on here :D 4=6? argh, what are you trying to do? I remember you posted something about how to add runways that had been found and I suggested pushing them to an array, but what exactly are you doing with them? My suggestion was to add runways that are selectable to an array so you can choose randomly between the selectable options, if it no longer becomes available for selection because it is full or something, you can delete it from the array. Can you explain exactly what you want to happen, maybe an array isn't the way but at the moment it is not clear at all about how your game works, the intention of the runway system and what occurs when they become unavailable.
B
47
S
17
G
82
Posts: 2,231
Reputation: 48,609

Post » Tue Aug 22, 2017 2:50 pm

I even posted an example there.
viewtopic.php?f=147&t=195037
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Aug 23, 2017 1:17 am

plinkie wrote:All I can say is WTF is going on here :D 4=6? argh, what are you trying to do? I remember you posted something about how to add runways that had been found and I suggested pushing them to an array, but what exactly are you doing with them? My suggestion was to add runways that are selectable to an array so you can choose randomly between the selectable options, if it no longer becomes available for selection because it is full or something, you can delete it from the array. Can you explain exactly what you want to happen, maybe an array isn't the way but at the moment it is not clear at all about how your game works, the intention of the runway system and what occurs when they become unavailable.




thanks for reply i have figured it out now

to explain it in a bit more english i have 3 known runways available to me and i am at runway 1 this runway will give me passengers for runways 2 or/and 3 so i can now fligh to 123 picking up passengers and dropping them off


now say i find runway 7 i have now got to make sure runway 1 only give passengers to runway 2 3 7 and so on
now say i find 14 then 6 then 8 as you add runways it starts getting complicated how to sort the passenger and runways together BUT I HAVE FOUND A WAY
bit it takes a bit of code to do it so i was just trying to find an easy way
:)
B
8
S
2
Posts: 21
Reputation: 1,327


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 26 guests