How do I pop a value from the middle of an array and...?

0 favourites
  • 2 posts
From the Asset Store
Relax and relieve stress by popping bubbles in Fidget Anti- Stress Releaser!
  • I'm currently storing side quest data in an array as a bunch of index values that I retrieve when displaying the quest log. Basically, "SidequestArray.at(0)=1, set QuestLogText1 to 'Find the herbs'" and so on and so forth, with each array slot corresponding to a QuestLogText and the values within being signifiers for individual quests. New side quests that the player picks up are added to the end of the array.

    When the player completes a quest that's stored in the middle of the array (and can't be popped front or back), I need to take out that number and move it to another array (CompletedQuests) while bumping up all the data behind it and maintaining the same array size so that there aren't any gaps/empty slots in the middle of the quest log. What's the best way to go about this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The best way is arguable but why not just move all the items up in a loop? Then push the number on your other array.

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