# [Solved]Custom movement behaviour vs. Every tick move self.X

Get help using Construct 2

### » Thu Dec 10, 2015 10:38 am

Hi I was wondering if its alright to use the: Every tick| Set X to Self.X + 1, to mimic movement? Will it play smoothly when running (it seems smooth just wondering)? If not is there another way to use events to code manually the custom movement or bullet behaviors so that they play smoothly?
I find the movement behavior quite limiting in what I am trying to achieve.

Another question, how is it possible for me to speed up a movement without making it look stepped? I.E. I would like an item to move at a pace of 5 pixels per tick, so I used: Set X to Self.X + 5
But now the movement is quite jittery. Is this where delta time comes in? I did some reading and will do some more, just making sure, thanks.
Last edited by Solomon on Fri Dec 11, 2015 5:42 am, edited 1 time in total.
Brick by brick, stone by stone.
B
58
S
25
G
18
Posts: 273
Reputation: 13,413

### » Thu Dec 10, 2015 10:59 am

I think the thing you're looking for is "dt". The reason your movement is jittery is the time per tick varies. "dt" is the length of time of the current frame. You can utilize that to find how far to move. The simple equation is:
Speed*time=distance

So dt would be the time.
For speed you wanted 5 pixels/tick and since there is 60 ticks/sec your speed would be 60*5 or 300 pixels/sec.
Sprite: set X to self.x+300*dt

Another benefit of using dt is the object will now go the same speed no matter the framerate.
You could get the same result using a behavior but it can be useful to do it with events. In this case it doesn't really matter either way.
B
97
S
36
G
131
Posts: 5,520
Reputation: 83,478

### » Fri Dec 11, 2015 5:25 am

@R0J0hound - thanks for the pointers, yep that works.

For anyone who is interested more in this subject I am linking to the appropriate tutorial:

https://www.scirra.com/tutorials/67/del ... dependence
Brick by brick, stone by stone.
B
58
S
25
G
18
Posts: 273
Reputation: 13,413