Is There A Way to Subtract From A Random Variable?

0 favourites
  • 8 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • So I'm trying to make a TCG and for this I need a deck, I didn't know exactly how to do it but I figured I'd do it by having the deck be an object that has a variable corresponding to every card in it, then whenever you draw subtract a random one and you draw that card... that probably isn't a good method, so an alternative way of doing this would also help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So you have one instance of the object Deck with many instance variables in it representing cards?

    Why not create many instances of Card object? It will be much easier to work with them, even if you don't need to display cards on the screen. You can add variables like isDrawn, isPlaying, cardValue and so on, pick cards, count them, filter, destroy etc.

  • So you have one instance of the object Deck with many instance variables in it representing cards?

    Why not create many instances of Card object? It will be much easier to work with them, even if you don't need to display cards on the screen. You can add variables like isDrawn, isPlaying, cardValue and so on, pick cards, count them, filter, destroy etc.

    Well yeah, I have many cards too. I just don't know how to do the whole random drawing from a deck list. Like I don't think there is a way to add or remove from families in game so it's not like I could just do a random from the family named "Deck" then remove it from the family when it's variable for the number of copies I'm playing hits 0. (I'm also just a bit tired rn so I could be thinking about this all wrong)

  • Check out this demo, it's quite old but may give you some ideas:

    howtoconstructdemos.com/template-for-a-card-game-shuffling-a-deck-of-cards-dealing-cards-to-two-players

  • Check out this demo, it's quite old but may give you some ideas:

    https://howtoconstructdemos.com/template-for-a-card-game-shuffling-a-deck-of-cards-dealing-cards-to-two-players/

    I still don't think this helps, like I'm sure he didn't intend on there being 3 king of clubs, there just is, also a bunch of 1 of cards is a lot different than some cards being played at 4, some being at 3, some being at 2, some at 1. Like the load of variety that there is.

  • You are right, I never noticed that there are 3 kings of clubs. It's because the deck size is 52 cards, not 54.

    also a bunch of 1 of cards is a lot different than some cards being played at 4, some being at 3, some being at 2, some at 1.

    Sorry, I don't understand what you mean by this.

  • You are right, I never noticed that there are 3 kings of clubs. It's because the deck size is 52 cards, not 54.

    > also a bunch of 1 of cards is a lot different than some cards being played at 4, some being at 3, some being at 2, some at 1.

    Sorry, I don't understand what you mean by this.

    Well it's a trading card game. Like in Yu-Gi-Oh! you're not playing a set list of 1 of cards, you're playing a bunch of cards that are different from your opponent to build a deck, you can run upto 3 of any 1 card in your deck (given it's not on the ban list) but you're not always playing 3 of everything, you might only play 2 or 1 of some cards. It's different than making every card in the game be in the deck and being at 1.

  • Regardless, create card instances. You can always count the number of specific cards, for example if you need to create card "A" but only if player doesn't already own 3 cards of this type:

    Card Compare instance variable Player="John"
    Card Compare instance variable Type="A"
    If Card.pickedCount<3 
    .....Create new Card
    
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)