Using Operators in a selection

0 favourites
  • 5 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • Hello, I have a quick question on my code, mostly on operators. My current exercise is further learning and this current project is to make a Tarot Reading web app. As to why, why not? I needed a project and seen one online and felt I could make a better one. Currently I am dealing the cards from the deck and with a deck of ten cards but will expand to the full 78 card set.

    Dealing the first two are easy. First chose a num from 1-10 and pickNth instance that match's a family var for each card and position that card on the table. Here is where I am having trouble, For the next 9 cards how do you deal them form the deck and only select the cards that have not all ready been selected.

    Right now my attempt is to use a while loop to say during this step (Action = 2) if Card Var Card 2 (ThatWhichCross) is equal to Var Card 1 (HeartOfMatter) set Var Card 2 to new value between 1 and 10; else if they are not equal than place card and stop loop, also set Var Card 3 (TopOfMind)

    That part works just fine however it is when I move to dealing with more than one var that I am running into trouble.

    While (Action = 3) if Var Card 3 is equal to Var Card 1 OR Card 2 than chose another value between 1-10. else if the inverse than place the card and stop loop.

    The issue I am thinking is in the Operators “TopOfMind = ThatWhichCross | HeartOfMatter” the OR expression just dose not seem to be working as I think it should be working.

    I also may be approaching this wrong, total possibility any help offered will be welcomed.

  • Im not really 100% sure how those cards work, but from what I recall its something about drawing some cards and based on those and some hokus pokus its possible to tell the future or something about a person?

    Anyway back to reality....

    Think you might be overcomplicating things a bit, try to look at it this way.

    "You have 10 cards and you want to draw a random card and no more than once."

    1. First of all you need something that can pick a random card. So as you have already done "Pick random Card".

    2. To make sure that the card doesn't get picked more than once. You need to mark a card as being "played" or "Used". This can be done with a simple Boolean, lets call it "Used".

    This is pretty much what you need to make it work, if you add them together.

    Card.Used = False : So only cards that are not used already are picked.

    Pick random Card ; Will pick a random card of those not in use.

    So after you play a card you mark "Used = true" and reset it to false when you want to reset the game.

  • Oooh, that is much more Practical than the way I was going about it. I got caught up in loops that I over looked booleans. Thank you kindly.

    And I am trying to leave as much "Hocos Pokus" out as I can. Each card has a meaning depending on where it is placed in the order on the table and they cross reference each other. I think it to be a good logic exercise believe me or not lol. And I even have a idea to expand it to make it a educational venture into Tarot, things that are not very well understood. "The cards only have the power that you yourself give. More importantly is understanding that the same is true for your life" © 2014

  • [quote:i6wqyltz]"The cards only have the power that you yourself give. More importantly is understanding that the same is true for your life" © 2014

    In other words hokus pokus

    Well I don't think you have to leave it out, im pretty sure that you can make it just as accurate as the real thing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote:zlogv8i8]"The cards only have the power that you yourself give. More importantly is understanding that the same is true for your life" © 2014

    In other words hokus pokus

    Well I don't think you have to leave it out, im pretty sure that you can make it just as accurate as the real thing

    Time will tell my friend

    MUCH better, now comes the fun part of padding it with all the text box content. This also allowed me to remove 10 Global Variables so again thank you. In a few days I will probably make a new thread showing my progress, in the appropriate section.

    But now I will probably call it a night.

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