Braus's Forum Posts

  • Hi dop2000

    Thanks for replying.

    2. You need to decide how you want to store these lists of categories/animations - you can read them from a text file (csv, xml etc) or load as JSON into an array or dictionary.

    Or you can simply create 6 text variables:

    category1 = "anima1,anima3,anima5"

    category2 = "anima2,anima4"

    ...

    I will use simple variables for this 1st test but I intend to use a DB to store and load informations.

    [quote:2m2n2ohh]3. When player selects a category, you can choose a random animation from a comma-separated string of animations using this expression:

    animationsList = category3 // for example

    animationName = tokenat(animationsList, floor(random(tokencount(animationsList, ","))), ",")

    Is this animation list will be filled by the string variable "category3" and the tokencount will be separate this information and randomize them? Is that correct?

    [quote:2m2n2ohh]

    Then set this animation to a sprite and choose a random frame:

    Sprite1 set animation to animationName

    Sprite1 set frame to floor(random(Sprite1.AnimationFrameCount))

    Repeat the same steps for the seconds sprite.

    I think I got it (but I am not sure) but anyway, I don't know how to avoid the animation/frame repetition (frames because a same frames could be found in more than an animation)

    [quote:2m2n2ohh]4. How do you assign a value to selected frame I don't know, you need to give more information about these values. What are they? Are they different for each frame? Where are you planning to get these values from?

    Simple points. For example: frame 1 worth 3 points, frame 2 worth 1 point, 3 worth 7 points...

  • 1) I have two sprites (sprite1 and sprite2) with the same animations (10 in total) with different amount of frames each:

    anima1 = pic1, pic2, pic3, pic4, pic5, pic6, pic7, pic8, pic9, pic10

    anima2 = pic3, pic5, pic7, pic8, pic9, pic10, pic12, pic15, pic16, pic17, pic18, pic19, pic20

    anima3 = pic1, pic3, pic5, pic7, pic9, pic11, pic13, pic15, pic17, pic19, pic21

    .

    .

    .

    anima10 = pic2, pic3, pic4, pic12, pic13, pic14

    2) The game will have 6 categories and each category will have references for some animations of the sprites I have cited:

    category1 = anima1, anima3, anima5

    category2 = anima2, anima4

    category3 = anima1, anima2, anima3, anima4, anima5, anima6, anima9, anima10

    .

    .

    category6 = anima1, anima2, anima5, anima6

    3) The player will choose between numbers 1 and 6 and the system needs to get the categories of the respective group and show a randomly frame of a randomly animation of the sprite1 and a different randomly frame of a randomly animation of the sprite2:

    Player choose number 3

    sprite1 = anima2 / pic4

    sprite2 = anima10 / pic14

    4) The player now needs to chose one of these two pictures and each will have a different value that I need to add to a score that represents the animation (each frame of each animation has a different value):

    Player choose pic14

    Add 5 to the scoreAnima10

    The last process (4) needs to repeat 10 times.

    At the end, I need to show the total score and what animation wins. If we have a tie, the system needs to show images of the respective animations to tie up.

    I need to understand what I need to do for each stage of the script.

  • Thank you!

  • Could you please share a simple example in CAPX?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "startGame = wallclocktime" should only be executed once on start of the game (level), not on every pressed key.

    It happens once when the user press the 1st key but I moved this command to the start of the layout.

    [quote:3ijb3v58]This formula is also incorrect:

    speedPerSecond= (totalHits) / (startGame)

    Change it to:

    speedPerSecond= (totalHits) / (wallclocktime-startGame)

    I fixed the formula but the time continues to increase as the keys are pressed.

  • I think I am doing something wrong. The value is increasing instead of showing the typing speed

    A summary of my code:

    On any key pressed: call checkKey()
                        call calculateTime()
                        controllStartGame = 0 : controllStartGame = 1
                                                startGame = wallclocktime
    on calculateTime: System keyOrder isTrue: add 1 to totalHits
    
    on checkKey:  speedPerSecond= (totalHits) / (startGame)
                  speedPerMinute=speedPerSecond*60
                  textObject : set text to round(speedPerMinute * 100) / 100[/code:19tt8cxv]
  • Thank you

  • You need to save the time when typing starts in a variable: gameStart=time

    When the last correct character is typed, you can calculate the speed:

    speed= (number of characters) / (time-gameStart)

    Multiply it by 60 to get characters per minute.

    If you need to count words per minute, this might be a little more complex.

    Hi

    Thanks for answering. I just want to count the characters.

    So I have to register the initial time and count all the characters the user typed at the same time that I need to divide it per initial time? Wiil I get this value in real time (as the user type the characters?) I read something about PPM but I don't know how to implement it.

  • I am trying to create a typing simulator and I need to calculate the speed of the typing and I don't know how I can do this.

  • Hi Bruno. Always saving me.

    Very nice solution. I will implement it.

    Many thanks.

  • I found a nice tutorial about a slide puzzle :

    The problem is that I don't know how to check if the player build the puzzle correctly to give you a award. Could someone please help me to figure out how to reward the winner? <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

  • Thanks Bruno. I had tried the "every X second" before but not in this way.

  • I am using this code to do this:

    • For each myInstance

    -- Pick a random myInstance

    -- myInstance is active >> wait 1 second

    -------------------------------->> myInstance set opacity to 0

    -------------------------------->> myInstance set active to true

    I believe it's easy, but not for me

  • Use the trick with families.

    Create a family with just this one object. Then you will be able to refer two different instances of this object in one event. Like this:

    dop2000

    I saw that you use a distance of 100 pixels for each one but in my case I will work with more than 2 instances. So I intend to register its positions in two local variables (positionX, positionY) and use them to define the place of each instance that I am changing.

    Thanks, this solution worked very well.

  • I am using the drag and drop behavior and when the instanced is dropped in another one I want that instances change its position but I don't know how to implement it. Could anyone help me with this?