How do I call twice the same function

Get help using Construct 2

Post » Thu May 05, 2016 11:31 pm

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
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Fri May 06, 2016 1:44 pm

Up. Please help.
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Fri May 06, 2016 2:04 pm

We'd have to see the code.
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Sat May 07, 2016 12:24 am

blackhornet wrote:We'd have to see the code.


Oh, of course. Sorry.

Image

Image

And the result is this:
Image
There is 3 plataforms overlapped.
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Sat May 07, 2016 1:09 am

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.
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Sat May 07, 2016 2:19 am

blackhornet wrote: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..
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Sat May 07, 2016 2:29 am

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).
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Sat May 07, 2016 5:43 am

(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)
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Sat May 07, 2016 6:01 am

Yes, this way worked.
So I will pass the parameters.
Thanks for you help!

Regards.
"Hello my friend stay a while and listen"
B
60
S
31
G
23
Posts: 79
Reputation: 16,374

Post » Tue Aug 02, 2016 3:46 pm

@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
B
4
S
1
Posts: 16
Reputation: 380


Return to How do I....?

Who is online

Users browsing this forum: alextro, Ryan Kocourek and 6 guests