How do I remove cards from hand with arrays.

0 favourites
  • 3 posts
From the Asset Store
Experience the true heartbeat of combat with "Combat Hits - Hand To Hand Fighting SFX."
  • https://imgur.com/a/tXbkT

    To summarize, I have made a board game where dependant on what tile you land on you draw a card, obviously items cards you'll keep in your hand. However if you use them, i'm struggling of a way to remove them.

    The way I have it implemented the array is X = Card Name and Y = is how many of the type of card you have in your hand. (aka, 5 potions or whatever).

    I have tried to make it so the game detects when you have 0 cards left of a certain type, it removes it. However you can only pop the front or back, (which honestly sucks since it'd be nice to pop specific values.) so i'm trying to switch it with the card below until the one that needs to be deleted has reached the back of the array where it will then be deleted. I'm obviously not doing something right here and after playing around with it for 2 hours i'm at a loss on what to try next. Any help or other possible easier solutions would be greatly appreciated.

    Note:

    • I typo'd remember which is why the variable is 'ramamber' and I found it funny so I didn't change it.
    • 'p1handfilter' no longer exists but I didn't delete the line since it doesn't do anything so I forgot about it.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use Array - Delete Index - Array.Indexof(CardYouWantDeleted)

  • How did I never see this before? Thank you very much.

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