小弟的目標是打算做到按下shift鍵,移動就變成跑步 
但目前卡在一個地方,就是不能判定shift鍵按住放開 
 
小弟的碼是這樣的 
 
void AARPGCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent) 
{ 
    Super::SetupPlayerInputComponent(InputComponent); 
    InputComponent->BindAction("Run", IE_Pressed, this, &AARPGCharacter::StartRunning); 
    InputComponent->BindAction("RunToggle", IE_Pressed, this, &AARPGCharacter::RunningToggle); 
    InputComponent->BindAction("Run", IE_Pressed, this, &AARPGCharacter::StopRunning); 
} 
 
 
void AARPGCharacter::StartRunning() 
{ 
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("開始跑步runing")); 
} 
 
 
void AARPGCharacter::StopRunning() 
{     
    GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("停止跑步 StopRunning")); 
} 
 
 
但變成我按shift鍵就同時跑出 
開始跑步 
停止跑步 
想問一下如何設定按下Shift鍵,就先出現「開始跑步」 
放開Shift鍵,就先出現「停止跑步」 
 
 
 |