How do I create an interactive shuffle?

  • I am trying to create a card game and I would like to implement an interactive shuffle that happens when the player shakes the device or moving their mouses quickly if they are playing it on the pc. I am wondering if these two options are possible and if someone can give me some simple tips about how to implement them. Thanks.

  • I would have it sample the current orientation, then if the touch accelerometer values change on at least two axis you can consider that the start of a shake.

  • I would have it sample the current orientation, then if the touch accelerometer values change on at least two axes you can consider that the start of a shake.

    Hi newt

    Sorry, but I did not understand what you are meaning. Do you know if I can find an example of your suggestion?

    To implement a real shuffle, I imagined changing the Z position of each card as the player shakes the device, when it is finished, the cards are put together in a single pile to be distributed to the correct place one by one. What do you think?

  • Well that would depend on the shuffle method, there's many ways to do that not just on the computer.

    I think most of the time you don't even see the faces during a regular shuffle anyway.

    The method I see most often is a spline moving the cards around from on spot to another.

    construct.net/en/make-games/addons/198/spline-movement

    Then for the shuffle you can just populate an array and match the card index.

    construct.net/en/make-games/addons/187/smart-random

  • Well that would depend on the shuffle method, there's many ways to do that not just on the computer.

    I think most of the time you don't even see the faces during a regular shuffle anyway.

    The method I see most often is a spline moving the cards around from on spot to another.

    https://www.construct.net/en/make-games/addons/198/spline-movement

    Then for the shuffle you can just populate an array and match the card index.

    https://www.construct.net/en/make-games/addons/187/smart-random

    Thanks, newt

    I'll give them a try and I 'll let you know the results later.

  • Hi newt

    I have checked the plugin e the behavior you had suggested. I got the smart random but I did not understand the spline movement and I did not find any example to check how it works.

    As I want to simulate some animations with the cards (shuffle and distributing them on the board), I intend to create a sprite with 52 frames (the total of a card deck) and create 52 instances of this sprite. The idea is to create a pile that the player will touch to distribute part of these cards on the board (as happens in a solitaire game). Every time the player touches the pile, the card moves to the right position and flips to reveals itself. The game will have another dynamic totally different from the solitaire game, that is already done. I just need to create these preliminaries.

    I would like to know your opinion on how I am planning this part of the game I explained above, and ask you to help me to understand how the spline movement works.

  • Kinda like this?

    dropbox.com/s/ipwpdmwwsszqpg0/dealspline.c3p

    Remember that you need to clean all the points if you do another spline.

  • Kinda like this?

    https://www.dropbox.com/s/ipwpdmwwsszqpg0/dealspline.c3p?dl=0

    Remember that you need to clean all the points if you do another spline.

    Thanks for the example. Is it possible to animate a sprite per time, positioning them in a specific place, as leaving the pile and going to a position on the board (like the rows in the solitaire game)?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, you would change the x by the card width every nth index.

    Search the forums for how % or, modulus works.

  • Yeah, you would change the x by the card width every nth index.

    Search the forums for how % or, modulus works.

    Thank you

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