RBuster's Forum Posts

  • Hi dop2000

    Thanks for the suggestions.

    I decided to use this solution:

    + AJAX: On "questions" completed

    -> System: Set totalQuestions to tokenat(AJAX.LastData,0,"|")

    -> questionsArray: Set size to (totalQuestions+1, 1, 1)

    -> questionsArrayTemp: Set size to (totalQuestions+1, 1, 1)

    ----+ System: controlRandom = 0

    --------+ System: For "For Each Questions Set" from 0 to questionsArray.Width

    ---------> questionsArray: Set value at i to tokenat(AJAX.LastData,i,"|")

    ---------> System: Add 1 to i

    ----+ System: Else

    --------+ System: For "For Each Questions Set" from 0 to questionsArrayTemp.Width

    ---------> questionsArrayTemp: Set value at i to tokenat(AJAX.LastData,i,"|")

    ---------> System: Add 1 to i

    --------+ System: Repeat questionsArray.Width times

    ---------> System: Set iTemp to int(random(1, questionsArrayTemp.Width))

    ---------> questionsArray: Set value at LoopIndex+1 to questionsArrayTemp.At(iTemp)

    ---------> questionsArrayTemp: Delete index iTemp from X axis

    And it worked very well. I just don't understand why the other solution generated so weird results. But this is not a problem.

  • This code should populate an array with random values that were loaded from a text file, without repetition. But instead of this, some values are appearing in more than one index. Could someone help me to find the problem in this code?

    + AJAX: On "questions" completed

    -> System: Set totalQuestions to tokenat(AJAX.LastData,0,"|")

    -> questionsArray: Set size to (totalQuestions+1, 1, 1)

    -> questionsArrayTemp: Set size to (totalQuestions+1, 1, 1)

    ----+ System: controlRandom = 0

    --------+ System: For "For Each Questions Set" from 0 to questionsArrayWidth

    ---------> questionsArray: Set value at i to tokenat(AJAX.LastData,i,"|")

    ---------> System: Add 1 to i

    ----+ System: Else

    --------+ System: Repeat questionsArrayTemp.Width times

    ---------> questionsArrayTemp: Set value at LoopIndex to LoopIndex

    --------+ System: Repeat questionsArray.Width times

    ---------> System: Set i to (floor(random(questionsArrayTemp.Width)))+1

    ---------> questionsArray: Set value at LoopIndex to tokenat(AJAX.LastData,i,"|")

    ---------> questionsArrayTemp: Delete index i from X axis

  • Capital 'i' is in two places somehow - in the same '5' section and in [13,"ADFIOQRT"]. Sorry, I have no explanation for this, other than I expect the first I is supposed to be lowercase.

    No problem. I included this character in the same section I found the other issue.

    Don't worry about this. This application continues to be very useful and I just have to thank you.

  • Someone else had this issue. Somehow during the copy and paste an escape backslash is lost for the backslash character! If you bring up the actual dialog for the spacing data, you'll see the [5,"I()\"] section is missing a backslash. Just type it back in and it all works: [5,"I()\\"]

    It's not clear to who's at fault here - C3, the browser, copy/paste, the text editor used to open the file. It's definitely odd.

    This part of the code was okay for me. The array code is exactly as appears in the txt/xml file:

    [

    [6," "],[3,",'"],[4,".|`´"],[5,";:"],[6,"\""],[5,"I()\\"],[6,"clt?!~"],[7,"er1-"],[8,"josvz[]"],[9,"bfgpquxy89"],[10,"Sahk34567/"],[11,"CEGn"],[12,"BHJKPd02"],[13,"ADFIOQRT"],[14,"LNXw"],[15,"V"],[16,"UYZm_"],[18,"M"],[22,"W"]]

    I did not find de "i" character in this array code. Is it right?

    EDITED - I found the error: I had two slashes on [6,"\""]. But I still have the problem with the "i" missing.

  • Hi blackhornet

    How are you?

    I am using the Sprite Font Generator (last version) to create a sprite font to use in C3. After I generated it I copy/paste the information in the script created specifically to C3 sprite font (spacing data field) but the space around the characters is not changing and I don't know why.

    For example: I created a sprite font and I pasted this script into the spacing data field;

    [

    [6," "],[3,",'"],[4,".|`´"],[5,";:"],[6,"\""],[5,"I()\\"],[6,"clt?!~"],[7,"er1-"],[8,"josvz[]"],[9,"bfgpquxy89"],[10,"Sahk34567/"],[11,"CEGn"],[12,"BHJKPd02"],[13,"ADFIOQRT"],[14,"LNXw"],[15,"V"],[16,"UYZm_"],[18,"M"],[22,"W"]]

    Nothing happened. I changed these values several times and even remove totally this script from the field and everything remains the same.

    If I change the "character spacing" value, it reduces the space around the characters but although this solves the problem of the most characters, others practically merge with the others.

    What am I doing wrong?

  • Thank you!

  • Hi dop2000

    Thanks for the capx.

    What I was imagining:

    - cards facing down

    - some cards leaving from the middle of the pile (some to the right of the pile and some to the left)

    - then these cards return to the pile: some coming up and some going down and this action repeats several times in a fast way.

    I don't need to show these cards after that and I already wrote the code to randomize the frames. I just need to create the animation that simulates a deck card shuffle.

  • I want to create a scrambled card animation (a simulation of cards moving sideways and then returning to the stack of cards as if it were shuffling), but I wanted to dynamically do this using a C3 behavior like Tween. The problem is that I cannot imagine how to do that, except creating the animation of each card. Could someone give me an idea of how to do this?

  • Asmodean

    I got it. Thank you!

  • I am trying to create an animation that moves each square to the right place according to the same id number and in an ordered way, starting with the id1 and finishing with the last one and with a quick interval between each one. I created the animation but not in the right order (my animation is starting with the last one and it's decreasing). I already tried to invert the count value and summing instead of subtracting this value but I am not getting it right. Please, some help.

    A sample:

    dropbox.com/s/91qz25ly3cu7djl/demo_animation.c3p

    Important: I don't want another solution. Please, don't change this script. I just want to understand what I need to do to fix this sample.

    Thanks

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

    Search the forums for how % or, modulus works.

    Thank you

  • 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
  • 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.

  • 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.

  • 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?