Hold shoot for auto fire
This commit is contained in:
parent
48519be2d7
commit
2bd7723269
Binary file not shown.
@ -7,9 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine", "Engine", "{94A6C6
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{8E2F6A87-1826-34F4-940C-CC23A48F9FE4}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{8E2F6A87-1826-34F4-940C-CC23A48F9FE4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresidentsBrigade", "Intermediate\ProjectFiles\PresidentsBrigade.vcxproj", "{97946AF8-2BBD-45DF-B560-04E9007DCB1A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresidentsBrigade", "Intermediate\ProjectFiles\PresidentsBrigade.vcxproj", "{96B177F0-8EDF-4729-A78F-BAD24CB85C00}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE4", "Intermediate\ProjectFiles\UE4.vcxproj", "{7B9D3087-59A5-43EF-B77B-4DBA855467B6}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE4", "Intermediate\ProjectFiles\UE4.vcxproj", "{79A8FA76-49BB-457C-B380-F831AAAAD3DE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@ -35,53 +35,53 @@ Global
|
|||||||
Shipping|Win64 = Shipping|Win64
|
Shipping|Win64 = Shipping|Win64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Android.ActiveCfg = Invalid|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Android.ActiveCfg = Invalid|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Win32.ActiveCfg = Invalid|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win32.ActiveCfg = Invalid|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Android.Build.0 = Android_DebugGame|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Android.Build.0 = Android_DebugGame|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win32.ActiveCfg = DebugGame|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win32.ActiveCfg = DebugGame|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win32.Build.0 = DebugGame|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win32.Build.0 = DebugGame|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win64.ActiveCfg = DebugGame|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win64.ActiveCfg = DebugGame|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win64.Build.0 = DebugGame|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win64.Build.0 = DebugGame|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Android.ActiveCfg = Invalid|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Android.ActiveCfg = Invalid|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Win32.ActiveCfg = Invalid|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win32.ActiveCfg = Invalid|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Win64.Build.0 = Development_Editor|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win64.Build.0 = Development_Editor|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Android.ActiveCfg = Android_Development|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Android.ActiveCfg = Android_Development|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Android.Build.0 = Android_Development|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Android.Build.0 = Android_Development|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win32.ActiveCfg = Development|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win32.ActiveCfg = Development|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win32.Build.0 = Development|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win32.Build.0 = Development|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win64.ActiveCfg = Development|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win64.ActiveCfg = Development|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win64.Build.0 = Development|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win64.Build.0 = Development|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Android.ActiveCfg = Android_Shipping|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Android.ActiveCfg = Android_Shipping|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Android.Build.0 = Android_Shipping|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Android.Build.0 = Android_Shipping|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win32.ActiveCfg = Shipping|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win32.ActiveCfg = Shipping|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win32.Build.0 = Shipping|Win32
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win32.Build.0 = Shipping|Win32
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win64.ActiveCfg = Shipping|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win64.ActiveCfg = Shipping|x64
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win64.Build.0 = Shipping|x64
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win64.Build.0 = Shipping|x64
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Shipping|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{7B9D3087-59A5-43EF-B77B-4DBA855467B6} = {94A6C6F3-99B3-346E-9557-ABF9D4064DBD}
|
{79A8FA76-49BB-457C-B380-F831AAAAD3DE} = {94A6C6F3-99B3-346E-9557-ABF9D4064DBD}
|
||||||
{97946AF8-2BBD-45DF-B560-04E9007DCB1A} = {8E2F6A87-1826-34F4-940C-CC23A48F9FE4}
|
{96B177F0-8EDF-4729-A78F-BAD24CB85C00} = {8E2F6A87-1826-34F4-940C-CC23A48F9FE4}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -85,6 +85,15 @@ void ABasePawn::Tick(float DeltaTime)
|
|||||||
{
|
{
|
||||||
Super::Tick(DeltaTime);
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Auto-fire.
|
||||||
|
*/
|
||||||
|
shoot_time_elapsed += DeltaTime;
|
||||||
|
if (shooting_enabled && shoot_time_elapsed > fire_rate_s)
|
||||||
|
{
|
||||||
|
shoot();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle death.
|
* Handle death.
|
||||||
*/
|
*/
|
||||||
@ -122,6 +131,17 @@ void ABasePawn::update_yaw_y(float y_component)
|
|||||||
yaw.y_component = y_component;
|
yaw.y_component = y_component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABasePawn::start_shooting()
|
||||||
|
{
|
||||||
|
shooting_enabled = true;
|
||||||
|
shoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ABasePawn::stop_shooting()
|
||||||
|
{
|
||||||
|
shooting_enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
void ABasePawn::shoot()
|
void ABasePawn::shoot()
|
||||||
{
|
{
|
||||||
FVector player_location = player_mesh->GetComponentLocation();
|
FVector player_location = player_mesh->GetComponentLocation();
|
||||||
@ -141,6 +161,8 @@ void ABasePawn::shoot()
|
|||||||
rotator,
|
rotator,
|
||||||
spawnParameters
|
spawnParameters
|
||||||
);
|
);
|
||||||
|
|
||||||
|
shoot_time_elapsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABasePawn::handle_death()
|
void ABasePawn::handle_death()
|
||||||
|
@ -27,6 +27,8 @@ public:
|
|||||||
virtual void handle_move_forward(float axis);
|
virtual void handle_move_forward(float axis);
|
||||||
virtual void update_yaw_x(float x_component);
|
virtual void update_yaw_x(float x_component);
|
||||||
virtual void update_yaw_y(float y_component);
|
virtual void update_yaw_y(float y_component);
|
||||||
|
virtual void start_shooting();
|
||||||
|
virtual void stop_shooting();
|
||||||
virtual void shoot();
|
virtual void shoot();
|
||||||
virtual void handle_death();
|
virtual void handle_death();
|
||||||
protected:
|
protected:
|
||||||
@ -101,6 +103,19 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, Category = "Attack")
|
UPROPERTY(EditAnywhere, Category = "Attack")
|
||||||
int32 max_health;
|
int32 max_health;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Attack")
|
||||||
|
float fire_rate_s;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shooting enabled;
|
||||||
|
*/
|
||||||
|
bool shooting_enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time elapsed since last shot.
|
||||||
|
*/
|
||||||
|
float shoot_time_elapsed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current health for character.
|
* Current health for character.
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +32,8 @@ void APlayerPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
|
|||||||
PlayerInputComponent->BindAxis("MoveRight", this, &ABasePawn::handle_move_right);
|
PlayerInputComponent->BindAxis("MoveRight", this, &ABasePawn::handle_move_right);
|
||||||
PlayerInputComponent->BindAxis("YawXUpdate", this, &ABasePawn::update_yaw_x);
|
PlayerInputComponent->BindAxis("YawXUpdate", this, &ABasePawn::update_yaw_x);
|
||||||
PlayerInputComponent->BindAxis("YawYUpdate", this, &ABasePawn::update_yaw_y);
|
PlayerInputComponent->BindAxis("YawYUpdate", this, &ABasePawn::update_yaw_y);
|
||||||
PlayerInputComponent->BindAction("Shoot", EInputEvent::IE_Pressed, this, &ABasePawn::shoot);
|
PlayerInputComponent->BindAction("Shoot", EInputEvent::IE_Pressed, this, &ABasePawn::start_shooting);
|
||||||
|
PlayerInputComponent->BindAction("Shoot", EInputEvent::IE_Released, this, &ABasePawn::stop_shooting);
|
||||||
PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Pressed, this, &APlayerPawn::boost);
|
PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Pressed, this, &APlayerPawn::boost);
|
||||||
PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Released, this, &APlayerPawn::reset_boost);
|
PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Released, this, &APlayerPawn::reset_boost);
|
||||||
}
|
}
|
||||||
|
2
todo.txt
2
todo.txt
@ -11,7 +11,7 @@ xAdd enemy cars
|
|||||||
xAttacks president car
|
xAttacks president car
|
||||||
xAdd dash
|
xAdd dash
|
||||||
xShoot from any direction
|
xShoot from any direction
|
||||||
Shoot at continuous rate when holding shoot button
|
xShoot at continuous rate when holding shoot button
|
||||||
Add local multiplayer
|
Add local multiplayer
|
||||||
Add netcode
|
Add netcode
|
||||||
Add player damage
|
Add player damage
|
||||||
|
Loading…
Reference in New Issue
Block a user