# Delta Time and Bullet Behavior

Get help using Construct 2

### » Tue Oct 30, 2012 3:56 am

According to the manual. All of the behaviors except for physics already make use of Delta Time.

Is this true as well for the bullet behavior?

Here's an example of one of my actions:
Every Tick:
spr_Player.Bullet.Speed + (30 * dt)

Or should I leave dt out of it?
Every Tick:
spr_Player.Bullet.Speed + 30

Or have I got things backwards?
Every Tick:
(spr_Player.Bullet.Speed + 30) * dt

Thanks!

-EdTaurian2012-10-30 03:57:01
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

### » Tue Oct 30, 2012 4:05 am

Bullet behaviour uses delta time, I have used it a lot :) No need to do anything. I often use a gradual increase to delta time (e.g. everytick > set timescale to timescale+0.001) to have things speed up over time, and it works on bullets.

If you want to exclude something, just set their time scale to 1 every tick too.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

### » Tue Oct 30, 2012 4:08 am

Ok, so I need to leave dt out of my events.

However, what about rotation? Not the "Rotate Behavior"

I'm talking about the "Rotate Clockwise" action under the "Angle" category in C2.

Do I need to apply dt to any of those?

Thanks for the help.
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

### » Tue Oct 30, 2012 4:12 am

Then yeah, use dt. So if you want it to rotate 60 degrees per second, use 60*dt. 120 degrees, 120*dt and so on. It really is very simple once you get used to it, and really makes a big difference on slower devices!Tobye2012-10-30 04:14:02
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

### » Tue Oct 30, 2012 4:52 am

Ok, and you're absolutely sure I don't use dt for Bullet.speed?

Example:

Every Tick:
(spr_Player.Bullet.Speed + 30) * dt
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

### » Tue Oct 30, 2012 5:05 am

If you want to add or change the speed of a bullet using a calculation you can use dt, so say you want to add 1 to the bullet speed 60 times per second, you go: everytick > set bullet.speed to bullet.speed+(60*dt).

However, if you adjust the timescale bullets will automatically move in accordance with the new timescale. So if your bullets move at 50 pixels per second, then you set timescale to 2, they will move at 100 pixels per second instead without you doing anything else.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

### » Tue Oct 30, 2012 5:22 am

Ok, thanks for the help Tobye...a ton.
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637