PRoblem......

Discussion and feedback on Construct 2

Post » Fri Jun 29, 2012 2:18 am

Friends, I'm creating shots for the player, but I want him to shoot from time to time, using Every X seconds, using the variable of the player, and ShotFreq variable shot, ReductionFreq.

Would be "Every ((player.ShotFreq-shot.ReductionFreq) / 10)"

However, the variable of the shot comes with a 0 value, even though set with 2.

I tried to set the variable at the beginning of the game with a Set Value System, but still has not changed, you know why?urbano2012-06-29 02:21:03
B
37
S
8
G
4
Posts: 85
Reputation: 5,099

Post » Fri Jun 29, 2012 2:25 am

I'd steer away from using 'every X seconds' for this type of thing. I think it's safer to use a timer.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,390

Post » Fri Jun 29, 2012 2:32 am

Timer = delta-time?
B
37
S
8
G
4
Posts: 85
Reputation: 5,099

Post » Fri Jun 29, 2012 2:35 am

Every tick, add dt to the timer. That will give a nice timer that increases once per second.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,390

Post » Fri Jun 29, 2012 3:18 am

Thanks.

But I must add one or 0.01?
And It's okay to smash the variable?
B
37
S
8
G
4
Posts: 85
Reputation: 5,099

Post » Fri Jun 29, 2012 3:22 am

The problem with adding 0.01 is that it'll eventually create an inconsistency, generating numbers like 0.01000000001
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,129

Post » Fri Jun 29, 2012 11:44 am

@urbano - add dt (a system expression) to the timer, otherwise it won't keep track of time properly. See this tutorial on delta-time for more information.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,208

Post » Fri Jun 29, 2012 8:59 pm

Thanks Ashley.
7Soul, told me that. Now I'm using Construct to the completion of the work of my graduate work.
Another problem I found was to change the value of an object at runtime and use it to count.

Thanks Scirra Friends
B
37
S
8
G
4
Posts: 85
Reputation: 5,099


Return to Construct 2 General

Who is online

Users browsing this forum: TheRealDannyyy, Zonacas and 14 guests