newbie question - still cannot decide actor or pawn... for multi purpose (for now movement)

Hello again.

It might be newbie question… but I really need advice while the deadline is tomorrow… (been researching… but my awareness is not that good to decide… sadly)

As my project is about 2D Final Fantasy-ish game with multiple objects, yet control only one object during non-battle.

At first, I decided to use actors for every characters and objects with using component.

Soon… I face different problem… moving the specific actor as I press input.

With looking at Parent class, I look like having 2 choices.

1.Every character as Actor, with attaching InputComponent (custom class that inheriting that)…

2.Every character as Pawn, with attaching MovementComponent (custom class that inheriting that)…

which one is sounds better for maintenance (i think i gonna use a lot of components)? and is there better way to do it?

for now, i need to control only one object by component from pawns or actors…

btw, I thought about character for every characters, but it does not have skeleton mesh… I don’t think the point of using character for my 2D project…

bummer… i guess it is too newbie. i think i will use every character as pawn for now… the deadline is coming

Hey,

can you maybe summarize again what you want to do? It wasn’t quite clear to me, what your issue is and what kind of controll the player should have over what actors.

I am sorry, my head is filled with a lot of thoughts, I could not tell exactly what I want. For now…

as single player 2D Final Fantasy game, i want to move one specific pawn from various pawn. i thought attaching PawnMovementComponent by BP to that pawn might work… but it didn’t

Hey Marjane,

Something that may help to understand is that all Pawns inherit from Actor, and can be used for controlling NPCs and other AI. For the actor you want to control, it would probably be best to use a Character which inherits from Pawn and has some specific functionality already setup (including movement).

Cheers

thx but what component do i need to add it to move as i press input?

character has already functionality? can u give me slight example?

Are you doing this in C++ or Blueprints? Take a look at the Blueprint guide for setting up input real quick.

If you are doing a C++ project, you still add inputs through the action mapping (like in the guide above), but the actual functionality is done in code (here’s an example from a fresh third person C++ character):



void AYourGameNameCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	// Set up gameplay key bindings
	check(InputComponent);
	InputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
	InputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);

	InputComponent->BindAxis("MoveForward", this, &APTCharacter::MoveForward);
	InputComponent->BindAxis("MoveRight", this, &APTCharacter::MoveRight);

	// We have 2 versions of the rotation bindings to handle different kinds of devices differently
	// "turn" handles devices that provide an absolute delta, such as a mouse.
	// "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick
	InputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
	InputComponent->BindAxis("TurnRate", this, &APTCharacter::TurnAtRate);
	InputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
	InputComponent->BindAxis("LookUpRate", this, &APTCharacter::LookUpAtRate);

	// handle touch devices
	InputComponent->BindTouch(IE_Pressed, this, &APTCharacter::TouchStarted);
	InputComponent->BindTouch(IE_Released, this, &APTCharacter::TouchStopped);
}

You can see that code is just binding function pointers which are called when their respective input events occur.

I tried similar way, but it didn’t work. is it because pawn?

Have you tried following this tutorial on Possessing Pawns? You should just need to pass your Player Controller to the pawn and it’ll move that character.

it is okay to use BP? I want to avoid to use BP for most of code, but… only using BP as putting component.

is there way to code it as C++?

Sure. That blueprint isn’t doing anything crazy, merely passing arguments to a method in C++ anyway. You can always move it into C++ later, but it’s probably more important to be done with this problem so you can keep working.

that pawn is moving suddenly… weird.

Taken out of this video at 0:50 :slight_smile:

thank you :slight_smile: