Training Stream - Tanks vs. Zombies: Movement and Aiming - April 5th

Lauren and return to continue their 2D Tanks vs. Zombies game with C++. In this stream, they’ll do a quick level tile map, and then add movement functions to their tank. With WASD to move and a click-to-aim turret, let’s get these tanks moving!


Tuesday, April 5th @ 2:00PM-3:00PM ET - Countdown



  • Training Content Creator )
  • Sr Documentation Engineer



From the first lesson, I still have the problem that whenever I move the childTurret in the TankBP viewport and recompile, the engine creates a new child which is visible in both the editor viewport and the BP viewport itself as described in the old anouncement thread by another user.
I checked my code and compared it with yours and it is literally the same but maybe I missed something. It would be nice if you could make a statement either at the beginning of the second video or in the thread about whether the UCHildActorComponent stuff is buggy in 4.11 or well, I don’t know to be honest :slight_smile: I started the project in 4.11 preview 4 or whenever your first lesson aired, just for your information.

To be honest with you guys, I really appreciate what you are doing for the community and I know this must be a lot! of work, but for the future I think it would be nice if you could have an eye on the accompanying thread for further help as the other thread didn’t get a lot of attention by both of you. (Of course there was GDC etc. so nothing personal :slight_smile: and I hope you take my opinion in a neutral way)

Lauren and I just checked this, and it happens here, too. That looks like a bug! I’ll report it to QA in a few minutes.

Well, it can be an issue if you use a different version of the engine from what we have. We used 4.10.4 on the stream, not 4.11 Preview 4, so that could cause errors. However, in this case, it’s a legitimate engine bug. It is worth noting that since the game re-instantiates all objects on startup, your tank in-game (including PIE) should be fine, and should have only one child turret, even though it will have more than one in the editor.

We do attempt to stay on top of threads, but some posts may fall through the cracks, or may be addressed by other people like community members or other Epic staff. We’ll see if we can improve that. Thanks for your feedback!

The source code from the stream is now available for download! Here’s a link to the thread:!-source-code-from-April-5-2016-livestream

it would be nice if you show how each part of code affects the tank(or game) instead of just typing the code and with a little explain on what it does , and after everything is done then showing the game.
its a little unclear for people like me who not familiar with C++ coding in UE . for me this part 2 was more like reading a documentation instead of watching a video tutorial.


I’ve had a ton of issues with this, but I eventually found out that my blueprints weren’t updating after changing the C++ files they derived from, which led to empty details panels on some components and various Static/Movable mismatch errors.

The only way I’ve found to update them is to change the parent to something basic like Actor, then back to Tank/Turret, which resets it as if I just created a brand new Blueprint. so have to re-set the sprites/rotations etc.

Also, not sure if it was really needed, but I also followed a workaround posted in an Answerhub post for the ChildActor parenting issue which suggested to set the Child Actor in Construction Script instead of the Component details panel.

After this, all was well in the world!


I’m trying to follow along with the tutorial but I’m stuck at the USTRUCT part. I’m using Engine 4.17 while this was designed to work with 4.10 so I know there will be changes.

I keep getting the below errors:

CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
CompilerResultsLog: Error: D:/UE4/Projects/Tanks/Source/Tanks/Tank.h(75) : LogCompile: Error: Type ‘FTankInput’ is not supported by blueprint. Tank.TankInput
CompilerResultsLog: Error: UnrealHeaderTool failed for target ‘TanksEditor’ (platform: Win64, module info: D:\UE4\Projects\Tanks\Intermediate\Build\Win64\TanksEditor\Development\TanksEditor.uhtmanifest, exit code: OtherCompilationError (5)).

And the Code I have for the struct is:

struct FTankInput

    // Sanitized movement input, usable for game logic.
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Tank Input")
        FVector2D MovementInput;

    void Sanitize();
    void MoveX(float AxisValue);
    void MoveY(float AxisValue);

    // Private because it's internal, raw data. Game code should never see this.
    FVector2D RawMovementInput;

I’ve tried to go ahead to see if something changed later on in the tutorials but I am unable to find this issue. Everything I’ve searched for just returns that the UPROPERTY needs to be editable in the Blueprint, so I’ve tried to change “BlueprintReadOnly” to “BlueprintReadWrite”.

Hey, ChappyOak! You’re right some changes have taken place that affect this code. USTRUCTS that you wish to use as UPROPERTIES must now be BlueprintTypes. So you just need to change this part of your code:

struct FTankInput

To this:

struct FTankInput

That change came about in 4.17, I think, or maybe 4.16, which is why this was fine in 4.10. That should get it working for you. I’ll update the source file when I get a . Thanks for watching and posting!

EDIT: On attempting this myself, there’s one other change that must be made before this will compile. The UArrowComponent’s header file, Runtime/Engine/Classes/Components/ArrowComponent.h, should be included in Tank.h. This will be in the source code update that I post in the next few minutes.

Here is the 4.17 version: Box

I can’t post it up top because made that post, but I’ll leave the link here for now until I can talk to the Community team about it.

, I made those changes and the errors I have listed were solved but now I have some other errors. I’ve tried to recreate the project with your source code to remove them, but they still remain. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\TanksGameMode.cpp(1) : error: Expected TanksGameMode.h to be first header included. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\TankStatics.cpp(1) : error: Expected TankStatics.h to be first header included. CompilerResultsLog: Error: D:\UE4\Projects\Tanks\Source\Tanks\Turret.cpp(1) : error: Expected Turret.h to be first header included. So I changed these lines to reflect the order required. I’m currently investigating the errors that followed, as they may be a result from some setting or lack of.

My turret always appears to aim directly 90 degrees to the left of the mouse location. I saw another post with the same issue, but can’t seem to find a link for it anymore.

Does anyone know what’s going on here?

I have the same problem. My turret is aiming 90 degrees to the left of my mouse location. There was another similar post with an answer, but the answer doesn’t seem to work.

This is a great tutorial, but I’m having a little trouble with the third stream. I’m my Turret.h I have forward declared ATanksVsZombies but it is giving me this error: 2>D:/UnrealEngine/Projects/TanksVsZombies/Source/TanksVsZombies/Turret.h(31): error : Unrecognized type ‘ATanksVsZombies’ - type must be a UCLASS, USTRUCT or UENUM
Any help would be great! Thank you!

My tank seems to move fine but it gets stuck after a short while.

Camera problems:

This does not work for me I got the same initial results as until 23:00 but the camera is still off - it is not pointing to the ground but “backwards”:


**Solution **- I had to remake this using blueprints and found that you need to use this line: [FONT=courier new]CameraComponent->SetWorldRotation(FRotator(0.0f, 0.0f, 0.0f));

That is there should be no -90 rotation on the Camera?

**Problems with [FONT=courier new]FVector2D MovementInput;? **

You are getting these errors: [FONT=courier new]…/Tank.h(19) : LogCompile: Error: Cannot expose property to blueprints in a struct that is not a BlueprintType. TankInput.MovementInput
…/Tank.h(80) : LogCompile: Error: Type ‘FTankInput’ is not supported by blueprint. Tank.TankInput

[FONT=courier new]// Manage Input
struct FTankInput


UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = “Tank Input”)
FVector2D MovementInput;

For some reason [FONT=courier new]BlueprintType is needed now, was not when this tutorial was done?