help with arrays and the choose command

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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

  • 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

  • All I can say is WTF is going on here 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I even posted an example there.

  • All I can say is WTF is going on here 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)