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

0 favourites
  • 3 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • 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.

  • 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.

    So your action would be:

    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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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