Sonic Slash implemented for Warrior. Build updated w/new features.

This commit is contained in:
2023-06-20 19:13:45 -07:00
parent dd75b5b52d
commit ccfeae19d4
14 changed files with 211 additions and 36 deletions
+64 -15
View File
@@ -2,6 +2,7 @@
#include "Player.h"
#include "Crawler.h"
#include "DamageNumber.h"
#include "Bullet.h"
#include "DEFINES.h"
INCLUDE_MONSTER_DATA
@@ -10,6 +11,7 @@ INCLUDE_ANIMATION_DATA
INCLUDE_SPAWNER_LIST
INCLUDE_DAMAGENUMBER_LIST
INCLUDE_CLASS_DATA
INCLUDE_PLAYER_BULLET_LIST
INCLUDE_game
const float Player::GROUND_SLAM_SPIN_TIME=0.6f;
@@ -150,7 +152,7 @@ void Player::Update(float fElapsedTime){
z=50*sin(3.3*(GROUND_SLAM_SPIN_TIME-spin_attack_timer)/GROUND_SLAM_SPIN_TIME);
spin_attack_timer=std::max(0.f,spin_attack_timer-fElapsedTime);
} else {
state=NORMAL;
SetState(NORMAL);
spin_angle=0;
z=0;
game->HurtEnemies(pos,3*12,GetAttack()*2.5);
@@ -163,9 +165,29 @@ void Player::Update(float fElapsedTime){
}break;
case BLOCK:{
if(rightClickAbility.COOLDOWN_TIME-rightClickAbility.cooldown>3){
state=NORMAL;
SetState(NORMAL);
}
}break;
case SWING_SONIC_SWORD:{
if(ability3.COOLDOWN_TIME-ability3.cooldown>0.5){
SetState(NORMAL);
switch(facingDirection){
case DOWN:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_S);
}break;
case RIGHT:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_E);
}break;
case LEFT:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_W);
}break;
case UP:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_N);
}break;
}
}
animation.UpdateState(internal_animState,fElapsedTime);
}break;
default:{
//Update animations normally.
animation.UpdateState(internal_animState,fElapsedTime);
@@ -226,18 +248,18 @@ void Player::Update(float fElapsedTime){
swordSwingTimer=0.2;
SetState(State::SWING_SWORD);
switch(facingDirection){
case DOWN:{
UpdateAnimation(AnimationState::SWINGSWORD_S);
}break;
case RIGHT:{
UpdateAnimation(AnimationState::SWINGSWORD_E);
}break;
case LEFT:{
UpdateAnimation(AnimationState::SWINGSWORD_W);
}break;
case UP:{
UpdateAnimation(AnimationState::SWINGSWORD_N);
}break;
case DOWN:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_S);
}break;
case RIGHT:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_E);
}break;
case LEFT:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_W);
}break;
case UP:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_N);
}break;
}
}
}
@@ -308,7 +330,34 @@ void Player::Update(float fElapsedTime){
if(ability3.cooldown==0&&GetMana()>=ability3.manaCost&&game->GetKey(CTRL).bPressed){
switch(cl){
case WARRIOR:{
//TODO
ability3.cooldown=ability3.COOLDOWN_TIME;
SetState(State::SWING_SONIC_SWORD);
AddBuff(BuffType::SLOWDOWN,0.5,1);
vf2d bulletVel={};
switch(GetFacingDirection()){
case UP:{
vel.y=70;
bulletVel.y=-400;
UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_N);
}break;
case LEFT:{
vel.x=70;
bulletVel.x=-400;
UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_W);
}break;
case RIGHT:{
vel.x=-70;
bulletVel.x=400;
UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_E);
}break;
case DOWN:{
vel.y=-70;
bulletVel.y=400;
UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_S);
}break;
}
PLAYER_BULLET_LIST.push_back(Bullet(pos,bulletVel,30,GetAttack()*8,AnimationState::SONICSLASH,true,2.25,true));
game->SetupWorldShake(0.5);
}break;
case THIEF:{
}break;