How to create a Continuously Moving Object (for endless runners)

  • 7 favourites


3,168 visits, 3,913 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

So, you'd want to learn about how to make a continuously moving object? Something that would always move, even though it looks like it won't change its position?

If not, than why are you here?

Nah, just joking.

This simple technique requires only one object, and no animations or events needed. So if you're using the free edition, (like me, for example) this would really come in handy.

It's most useful for endless runner games, like that of flappy bird, for example.

For this example, we would be using an empty 4:3 portrait. I'd wanted the layout to fit the screen borders, so I set the layout size to 480, 640. And to make extra space, I set the margins to 1000, 1000.

Anyways, let's get to the tutorial already.

First off, we need an object to work with. For the best results, you should use a tiled background. For this example, I made the tiled image to be 64, 64.

And, you should remember this: If you want the object to move left or right continously, ALWAYS make the width larger than the layout's width. However, you can always tweak the height to be larger or smaller.

Next, we need to add behaviors. I used the Solid behavior for my continously moving object.

But, these two behaviors are crucial for the continuously moving object: Wrap and Bullet.

Now, we need to change the behaviors to best suit our needs. First and foremost, Wrap does not need to be changed. But, you can change it to Viewport to ensure it won't leave the screen.

Second, and most importantly, the Bullet behavior. It could be set to accelerate, depending on your game. But, it should always be set to enabled. Also, you should set its speed. The speed can be independently changed.

But, you should know this: Speed=Direction.

If its moving left or right, you should know: If the number is positive, it will appear to move backwards. If the number is negative, it will appear to move forwards. (These last two sentences would only make sense, if you want it to appear to move forward. If you want backwards, then its the other way around.) For my example, I set the speed to -100.

Last but not least, we should place another object of the same type, right next to the continuously moving object. However, it should have the same properties as the first object. And, it should be directly next to the first object. That means not even a 1 pixel gap.

(If there is only one object, then the object's other side would not go through, until the entire object already went through, leaving a huge gap.)

And, like that, you're done! It's really that simple to make. (There's probably a much better technique, but i'm sure its hard to find.)

Also, if the two object's graphics are improperly placed, even if they are directly next to eachother, than the second object may have to be moved further into the first object. And, it's size may have to be changed.

Any feedback can be accepted. If there's anything you have to say, please leave a comment.



  • Order by
Want to leave a comment? Login or Register an account!