Getting PaperCharacter to Move with C++

Hello world!

So I am having trouble getting my 2D PaperCharacter to move using C++.

Here is my .h file:

48675-h_file.png

And here is my .cpp file:

Finally, here are my bindings from the project settings:

I noticed that there is not constructor in the .cpp file? When I generated the class from a 2D PaperCharacter
it did not put a constructor inside the body. Also, note that the code DOES compile, I just can’t move the
player in-game. Most of the red lines are stating that the item they are under are undefined. Is there something obvious that I am missing? Does the super class PaperCharacter
work differently than the Character class?

Thanks!

Hello,

I am sorry to hear about your problem.

Please note that you should declare SetupPlayerInputComponent function like this:

virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

As you can see, function’s name starts with capital ‘S’ and override keyword should be provided (since the method overrides the implementation of the base class).

As for the constructor, with GENERATED_BODY() macro it is no longer necessary to explicitly provide one (unless you need it).

Hope this helped!

Have a great day!