0 Favourites

change an entire column in array?

  • Hi, sorry for my english in advance:

    I am making a game in which you buy ships to play with. I want to use a array to make the changes in the ships that are equipped, this is my solution in theory:

    this is an example of the array:

    ship1---Equipped

    Ship2---NotEquipped

    Ship3---NotEquipped ... and so on

    So, when the player equips "ship 3", for example, I want all the other ships to change to NotEquipped, this will make easier to add ships in the future. I don�t know if there is a way to make a simple programming for this or a bunch of conditionals like:

    IF click on "ship2 equipButton"------ set Ship1 to NotEquipped

                                          set Ship2 to Equipped

                                          set Ship3 to NotEquipped...

    hope it was clear and someone can help.

    thank you.

  • Just use a For loop to set all to NotEquipped first, THEN set the appropriate slot to Equipped.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Sorry but I dont quite get how to use the for loop in the array to solve my problem, I�m quite new using it, if you could be more specifir it will be a great help, Anyways I will try to figure it out. tnx for respopndig.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
195 16,205
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
102 6,404
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
56 6,106
broknecho's avatar
broknecho