So the last problem is the way i’m currently dealing with axis bindings.
I ended up having to place the axis bindings back into my ABasePlayer, as it just wasn’t working inside the controller… my mistake i’m sure…
The issue is now, that the ABasePlayer has no idea of which player number it is and thus which axis bindings to use (I have labelled mine Player0MoveRight, Player1MoveRight etc.).
There were 2 choices, I’d love the answer to both if ya know what’s wrong:
Choice 1:
I add a property to the ABasePlayer, populate it in my LoadPlayers loop with the index of the current loop.
The problem is when the SetupPlayerInputComponent is called, that property is NULL again? If it wouldn’t nullify, this would be my preferred way of doing it.
Choice 2:
I find a function that returns the current players number, is there a function for this?
This is where the code is supposed to be:
void ABasePlayer::SetupPlayerInputComponent( class UInputComponent* InputComponent )
{
int32 playerNumber = // A function that returns the player number
FString axisName = FString::Printf( TEXT( "Player%dMoveRight" ), playerNumber );
InputComponent->BindAxis( FName( *axisName ), this, &ATemplatePlatformerCharacter::MoveRight );
}