How do I call twice the same function

0 favourites
  • 10 posts
From the Asset Store
Voice call plugin based on webrtc protocol for construct 3
  • Hello guys!

    I am having a little problem..

    I have made a function which randomize and save the result in a variable and after this function calls another function based on the result of the random.

    Well.. It works well when I use in single events, but I am trying to call this function twice at the layout start.

    When I do this, the function dont randomize twice, only do the rest.

    So this first function just randomize and the second one just create a object.

    And when i call twice only the second function works.

    Do you know how can I fix it?

    Regards

  • Up. Please help.

  • We'd have to see the code.

  • We'd have to see the code.

    Oh, of course. Sorry.

    And the result is this:

    There is 3 plataforms overlapped.

  • It's not really clear what you are describing. Having said that, there are several issues.

    Plataformas references Function.Param(1) but you aren't passing in any parameters. Chances are your calculation will be negative.

    Tipo_proxima_Plataforma gets a random value from 0 to 27, but you are only decoding five items (or are there more off the screen?).

    You can always use Browser.Log to log to the Console, so you can see what is happening in the code.

  • It's not really clear what you are describing. Having said that, there are several issues.

    Plataformas references Function.Param(1) but you aren't passing in any parameters. Chances are your calculation will be negative.

    Tipo_proxima_Plataforma gets a random value from 0 to 27, but you are only decoding five items (or are there more off the screen?).

    You can always use Browser.Log to log to the Console, so you can see what is happening in the code.

    Function.param(1) will be used only when a platafoms pass the bottom of screen, the plataform will pass your Y position to calculate the next platafom, in this case is not necessary.

    Yes, I have all the options i didnt put here because is all same..

  • You'd have to post a CAPX for more help. There's just not enough here to help. The first param is actually Function.Param(0).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • (CAPX was sent to me privately).

    So it is the parameters, and the fact that you aren't setting any. Change:

    Posicao_Proxima_Plataforma=Function.Param(0)-tamanho_tela_plataforma-Distacia_Entre_Plataformas

    And then for the three Plataformas calls, pass in a parameter. I don't know what numbers you want, but the following worked:

    Plataformas(100)

    Plataformas(-300)

    Plataformas(-600)

  • Yes, this way worked.

    So I will pass the parameters.

    Thanks for you help!

    Regards.

  • klabundee Not sure if this allowed to post it like that, but please drop me e-mail (on peter-at-headshotlab-dot-com) about music for your game. I still can't send PM's while my reputation is below 500. Hope you understand and looking forward to your message.

    Regards, Petr

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