Skip to content

Commit

Permalink
Merge pull request #55 from yxue5/Issue17
Browse files Browse the repository at this point in the history
Finished Issue 17
  • Loading branch information
yxue5 authored Apr 4, 2018
2 parents 4252e79 + 1fbbfb7 commit f78ee52
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 6 deletions.
Binary file modified ProjectEroica/Content/Blueprints/BP_Enemy.uasset
Binary file not shown.
Binary file modified ProjectEroica/Content/Blueprints/BP_MyCharacter.uasset
Binary file not shown.
Binary file modified ProjectEroica/Content/Map_Assets/ShipMap.umap
Binary file not shown.
Binary file modified ProjectEroica/Content/Map_Assets/ShipMap_BuiltData.uasset
Binary file not shown.
2 changes: 1 addition & 1 deletion ProjectEroica/Source/ProjectEroica/AnimInstanceKisa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void UAnimInstanceKisa::HandleState(FString newState) {
else if (newState == "JumpAttack") {
UGameplayStatics::PlaySound2D(this, JumpAttackSound);
}
FString path = "AnimSequence'/Game/Art_Assets/Animations/" + newState + "." + newState + "'";
FString path = "AnimSequence'/Game/Art_Assets/Animations/" + newState + "." + newState + "'/";
ourAnimation = Cast<UAnimSequence>(StaticLoadObject(UAnimSequence::StaticClass(), NULL, *path));
State = newState;
playOurAnimation();
Expand Down
2 changes: 1 addition & 1 deletion ProjectEroica/Source/ProjectEroica/AnimInstanceKisa.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PROJECTEROICA_API UAnimInstanceKisa : public UAnimInstance
USoundBase* PainSound;

UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Animations")
UAnimSequence* ourAnimation = Cast<UAnimSequence>(StaticLoadObject(UAnimSequence::StaticClass(), NULL, TEXT("AnimSequence'/Game/Art_Assets/Animations/Idle.Idle'")));
UAnimSequence* ourAnimation = Cast<UAnimSequence>(StaticLoadObject(UAnimSequence::StaticClass(), NULL, TEXT("AnimSequence'/Game/Art_Assets/Animations/Idle.Idle'/")));

//plays the actual animation
UFUNCTION(BlueprintImplementableEvent,BlueprintCallable)
Expand Down
16 changes: 12 additions & 4 deletions ProjectEroica/Source/ProjectEroica/TP_SideScrollerCharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

ATP_SideScrollerCharacter::ATP_SideScrollerCharacter()
{
State = Idle;
// Don't rotate when the controller rotates.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
Expand Down Expand Up @@ -99,6 +100,7 @@ void ATP_SideScrollerCharacter::BeginPlay()
CharWeapon->wepOwner = this;
CharWeapon->AttachToComponent(GetMesh(),FAttachmentTransformRules::SnapToTargetIncludingScale, FName("WeaponSocket"));
}
State = Idle;
//Sets up connections to Animation Instance
AnimInst = Cast<UAnimInstanceKisa>(GetMesh()->GetAnimInstance());
AnimInst->owningChar = this;
Expand Down Expand Up @@ -215,22 +217,28 @@ void ATP_SideScrollerCharacter::Attack()
void ATP_SideScrollerCharacter::handleAttack(float dmg, FString stunType, float stunDuration, FVector force, float attackDirection)
{
//position the character to the direction of the attack
float knockupOffset = 1;
float knockupDirection = 1;
if (attackDirection < 1) {
SetActorRotation(FRotator(0, 0, 0));
knockupOffset = -1;
knockupDirection = -1;
}
else SetActorRotation(FRotator(0, 180, 0));
UGameplayStatics::PlaySound2D(this, AnimInst->HitSound);
UGameplayStatics::PlaySound2D(this, AnimInst->PainSound);
Stats->hp -= dmg;
State = stunType;

//if we're dead then disbale input
if (Stats->hp <= 0) {
//State = Death;
//PrimaryActorTick.bCanEverTick = false;
//DisableInput(ourPlayer);
//UE_LOG(LogTemp, Warning, TEXT("Dead!"));
}
if (State == Stunned) {
GetWorld()->GetTimerManager().SetTimer(StunHandle, this, &ATP_SideScrollerCharacter::EndStun, stunDuration, false);
}
else if (State == Knockup) {
force.Y = force.Y *knockupOffset;
force.Y = force.Y *knockupDirection;
LaunchCharacter(force,true,true);
//UE_LOG(LogTemp, Warning, TEXT("knockup Y %f"), force.Y );
//UE_LOG(LogTemp, Warning, TEXT("knockup Z %f"), force.Z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ATP_SideScrollerCharacter : public ACharacter
FString Combo4 = "Combo4";
FString Combo5 = "Combo5";
FString Land = "Land";
FString Death = "Death";

//sets char back to idle when appropriate
UFUNCTION()
Expand Down

0 comments on commit f78ee52

Please sign in to comment.