mapsandapps's Forum Posts

  • 1 posts
  • Hi! I'm trying to make a solitaire card game. I'm not really sure what sort of data structure(s) I should be using in Construct to manage the state of the card stacks. Each of the cards has an instance variable with an ID, which is all I really need to store in the data structure, and I could work everything else out from that.

    In this game, there are five columns of stacks. One or more of the columns could be empty at any particular time. Each of the columns can have multiple stacks. I.e. in the included image, [13,56,23] is one stack and [38,57] is a second stack in the same column. There could be any number of these stacks (well, technically up to 30 or so, because of other limitations in the game). Any particular stack could contain any number of cards, although I could and probably will insert an artificial constraint limiting this to 20 or so.

    I thought maybe I should be using a multi-dimensional array, but it seems like those are more aimed towards data that doesn't have any empty values in it. How should I be storing the data to be able to push, pop, and query the IDs of cards in the various stacks?

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1 posts