Assigning Priorities

Hello all, have been working on a pretty simple card game, I hit a snag and cannot seem to figure it out. Is there a way to assign priorities to actors? For example, at a certain point, I select cards that have been dealt, then I want the selected cards to be moved to another location. Everything is fine except, the cards move to the x,y I set for them to move. What happens is when the cards are in a row and say I select the 2nd and 4th card out of 10, when I press a button they move above on the table in the 2nd and 4th position creating an empty space where the 3rd card would have been. I would like the selected cards to be moved and kept together. Thank you very much.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @greggsalad said:
    Hello all, have been working on a pretty simple card game, I hit a snag and cannot seem to figure it out. Is there a way to assign priorities to actors?

    Sure, you can use assign a state to an integer game attribute (e.g. game.State) and have certain actors increase the value of the attribute and other actors only trigger rules when the attribute is a certain value.

    @greggsalad said:
    Everything is fine except, the cards move to the x,y I set for them to move.

    Is that not the desired behavior?

    @greggsalad said:
    What happens is when the cards are in a row and say I select the 2nd and 4th card out of 10, when I press a button they move above on the table in the 2nd and 4th position creating an empty space where the 3rd card would have been. I would like the selected cards to be moved and kept together.

    I can't visualize this. Can you provide a screenshot of what the scene looks like just before and just after this occurs?

  • greggsaladgreggsalad Member Posts: 5

    Thank you for the reply, enclosing a screenshot. Cards1 image shows 5 cards dealt out, Cards2 image shows the selected cards moved (2-diamonds) and (5 hearts), I created a rule, when the card is pressed it will move to the new location, but notice how it is spaced when they move, I want them to move and stay close together. http://s857.photobucket.com/user/designdesigns/media/cards1.png.html?sort=3&o=0
    http://s857.photobucket.com/user/designdesigns/media/cards2.png.html?sort=3&o=1
    Thank you

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    If you want them to move positions where they are closer together, then move them to those positions. It all depends on how you have your rules set up but here's how I would go about it:

    Keep track of the number of cards that have been dealt in an integer attribute called game.cardsDealt

    When you move a card, move it to x=game.startingPosition+game.cardWidth*game.cardsDealt and then increase game.cardsDealt by 1.

    That way, the first card (with game.cardsDealt=0) will be at x=game.startingPosition, the second card (with game.cardsDealt=1) will be at x=game.startingPosition+game.cardWidth, etc. You'll probably want to add a gap value as well so that your cards aren't touching. Or maybe you want an overlap, in which case you'd make game.cardWidth less than the actual width of the actor.

  • greggsaladgreggsalad Member Posts: 5

    Just reading that cleared up a lot of the fog. I am going to work on it now...Thank you for the insight, I felt it was done through attributes, but being so new, I am still uncertain of things. Thank you again.

  • greggsaladgreggsalad Member Posts: 5

    Ok, following the formula gets the card placement perfectly if I select card 1 (the left most card) and card 2 (the 2nd in sequence), what happens if I do not choose card 1, I wish for card 2 to take the left most position when the move to the new location, however it flies off the screen to the right. So, if I have 5 cards laid out, I choose the 2nd and 4th for arguments sake, I would like those two chosen cards to move above to a new location, but be next to eachother, and if i chose 2nd and 5th card, same effect. Finally if I chose 4 of the cards, they would all move to the new location next to eachother... Sorry, it is hard to write what I am tying to achieve.

  • greggsaladgreggsalad Member Posts: 5

    Here is a sketch to clarify what I am trying to convey. Any card chosen will move left to right above, however if a card is there, it will move right, and so on... I tried collide, but that made a complete mess because the cards kept touching eachother. http://s857.photobucket.com/user/designdesigns/media/cardlayout.png.html

Sign In or Register to comment.