0% found this document useful (0 votes)
97 views9 pages

2D Game Depth Tutorial

This tutorial teaches how to create a top-down 2D airplane game in Unreal Engine by setting up different depth layers and animating textures to create a sense of movement. Key steps include setting up an airplane actor with animation controls, a camera to follow the plane's movement, tiled background textures on separate material layers, and using panners to animate the textures at different speeds to simulate motion parallax as the plane moves through the level.

Uploaded by

swonera
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views9 pages

2D Game Depth Tutorial

This tutorial teaches how to create a top-down 2D airplane game in Unreal Engine by setting up different depth layers and animating textures to create a sense of movement. Key steps include setting up an airplane actor with animation controls, a camera to follow the plane's movement, tiled background textures on separate material layers, and using panners to animate the textures at different speeds to simulate motion parallax as the plane moves through the level.

Uploaded by

swonera
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

TOP DOWN AIRPLANE GAME

This tutorial is an extension to the top down tutorial on the website, so please do that one first in order to understand this one. This tutorial skips around a little, but it is easily understood if you do some of the other tutorials first. This tutorial will teach you how to set up different layers of depth for a simple, 2D game. It will discuss how to design the level in a simple seamless/tileable way. It will show you how to animate your airplane in game without a character, and it will show you how to fake depth in a 2D game. You are expected to know how to use the UT3 Engine, Kismet, Matinees, and Interp Actors. My level is set up as the following: 1 - 2048 x 2048 x 2048 subtracted volumewe need it large so the plane can fly around. 1 light large enough to light the leveladd better lighting when finished. 1 player start in the bottom left corner 1 3D model of an airplane in the bottom right corner 3 Textures (ocean, islands, and clouds). Make them all tileable and/or seamless 1 Camera Actor (Generic Browser>Actor Classes Tab>Camera Actor) Here is my level setup:

In this example, Im just using an interp actor from the game. The camera I put above the light and aimed down for a top view of my plane. From other tutorials on the site you will have learned how to make the camera follow the player. So you can either attach it to the plane, so the plane can fly around your entire level, or you can set it up as a stationary camera and create a scrolling environmentwe are doing the scrolling environment. So, set up your camera so that it sees the entire level, and press F4 to change any properties that you might need. I adjusted my aspect ratio and FOV angle.

Now the reason we have the airplane in the bottom right corner is so that we can set up the animation correctly. We will be using the W, A, S, and D keys to fly the plane and will be using the interp actor and not a vehicle.

So, here is the kismet. Its similar to a lot of the other tutorials, but slightly different. When the level begins, we start the idle airplane animation that we have set up (plane floating) with a matinee. We toggle cinematic mode on so the player cannot do anythingbut set the bDisableInput to False because we do want input from the player. The player start is so Unreal will load the level and not crash, but we are not going to use the player. We will put the player start off screen, meaning where the camera cannot see it, and we will hide the player just in case.

We will also turn on our camera matinee that we created and have it set to loop in the properties. For that all you need to do is set one key frame on the camera and set one key frame for the director group. Then we will open our UIScene. Like another tutorial, we create a UIScene with 4 buttons outside the blue square so that they are hidden.

And we set the scene properties to: Always render Dont show the cursor Dont pause the game And SceneInputMode to matching. Each button has the same kismet (right click on the button).

For this example: After you right click on your button and choose Kismet, click on the enabled state of the button, and double click on the diamond in kismet. Choose your button commands. When I press the W key, the plane will fly forward/up on the screen, which will be a matinee event. When W is released, it will activate another eventin this case, a STOP playing the matinee/animation event. A would fly left. S would fly backwards. D would fly to the right. So to set that up, take a look at the kismet again:

When I press a button, no matter what buttonw, a, s, or d, they all stop the idle animation, and they stop all the other animations to. In this case there are only 2 animations. We animated our plane flying up the screen and left on the screen. If you think about matinee. If W makes the matinee play forward, S will play in reverse. If A plays forward (animation to the left), D plays in reverse (animation to the right). Each button also has a STOP event script. You can see it at the top of the kismet. When any button is released, all movement stops and the idle plays forward again. (in this shot, the link from the STOP event to play on the idle matinee is broken)

. You can see in these pics that the plane was animated only until it touched the top of the camera view/screen.

Ok, now that our plane is moving on screen, the camera is recording it and we are watching through the camera, now we need to set up our level. Well, the level is already done since the interp actor can only move based on its animation. But, we need to set up the scrolling part. For this we need to import our seamless water texture and/or island textures, put them on a material, and animate them. In this example, I have water and clouds on two different layers for added depth, which we will get to in a moment.

I have added 2 texture samples (this is where your textures go). It is all my diffuse/color. Now for the animation. You need a PANNER. Connect the panner to the UV of your texture samples. In this example, I have the water panning in the Y at a different speed than the cloudsremember things farther away from you will move slower than things closer to you. I used Y because it worked for my scene. You might have to change it around a little. I also had to right click on my polygon floor and change the surface properties until it looked and moved correctly. Now for more depth. You will see that I have an extra layer of clouds.

I have added one additive plane with a cloud material on it. I also added a panner to it as well. Depending on what type of game you are creating, you might want more layers of depthits up to you, just remember that closer things move faster, but should have less visibility so you can see your player. After doing the other tutorials on the site, you should be able to attach particle flames to your airplane, have the start only when the plane moves, have special effects in the game, shoot items out of the plane, and have other items in your game to collect, shoot, destroy, etc.

You might also like