O'Reilly logo

Learning Construct 2 by Aryadi Subagio

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning random generation

I defined random generation at the beginning of this chapter and now I will discuss it in a technical fashion. We will create the obstacles at a random position on the scrolling ground. So, first we will make the ground scroll.

Making the ground scroll

To make the ground scroll, we need to first make it move in one direction at all times; to do this, we need to use a movement behavior. We'll use a behavior that is different from the 8 Direction behavior; to make an object move in one direction, we will use the Bullet behavior. Add this to the ground object, just like we added the 8 Direction behavior to the plane object. It doesn't matter to which of the two instances of the ground object you add the behavior; it will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required