Bullets do not die immediately when view goes offscreen anymore. Initial jump states and setup for Slime King are now implemented.

This commit is contained in:
2023-09-09 07:10:31 -05:00
parent efdf696d2c
commit 942e8e0ef7
18 changed files with 151 additions and 67 deletions
+15 -15
View File
@@ -160,7 +160,7 @@ float Player::GetSpinAngle(){
return spin_angle;
}
State Player::GetState(){
State::State Player::GetState(){
return state;
}
@@ -207,7 +207,7 @@ void Player::Update(float fElapsedTime){
//Class-specific update events.
OnUpdate(fElapsedTime);
switch(state){
case SPIN:{
case State::SPIN:{
switch(facingDirection){
case UP:{
if(lastAnimationFlip==0){
@@ -233,7 +233,7 @@ void Player::Update(float fElapsedTime){
z="Warrior.Ability 2.SpinMaxHeight"_I*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 {
SetState(NORMAL);
SetState(State::NORMAL);
spin_angle=0;
z=0;
float numb=4;
@@ -245,14 +245,14 @@ void Player::Update(float fElapsedTime){
}
animation.UpdateState(internal_animState,fElapsedTime);
}break;
case BLOCK:{
case State::BLOCK:{
if(blockTimer<=0){
SetState(NORMAL);
SetState(State::NORMAL);
}
}break;
case SWING_SONIC_SWORD:{
case State::SWING_SONIC_SWORD:{
if(ability3.COOLDOWN_TIME-ability3.cooldown>0.5){
SetState(NORMAL);
SetState(State::NORMAL);
switch(facingDirection){
case DOWN:{
UpdateAnimation("WARRIOR_IDLE_S");
@@ -270,11 +270,11 @@ void Player::Update(float fElapsedTime){
}
animation.UpdateState(internal_animState,fElapsedTime);
}break;
case TELEPORT:{
case State::TELEPORT:{
teleportAnimationTimer=std::max(0.f,teleportAnimationTimer-fElapsedTime);
if(teleportAnimationTimer<=0){
SetPos(teleportTarget);
SetState(NORMAL);
SetState(State::NORMAL);
}
animation.UpdateState(internal_animState,fElapsedTime);
}break;
@@ -304,13 +304,13 @@ void Player::Update(float fElapsedTime){
ability4.cooldown=0;
}
for(Monster&m:MONSTER_LIST){
if(!HasIframes()&&OnUpperLevel()==m.OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(m.GetPos(),12*m.GetSizeMult()/2))){
if(!HasIframes()&&abs(m.GetZ()-GetZ())<=1&&OnUpperLevel()==m.OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(m.GetPos(),12*m.GetSizeMult()/2))){
if(m.IsAlive()){
m.Collision(this);
}
geom2d::line line(pos,m.GetPos());
float dist = line.length();
m.SetPosition(line.rpoint(dist*1.1));
m.SetPos(line.rpoint(dist*1.1));
if(m.IsAlive()){
vel=line.vector().norm()*-128;
}
@@ -382,7 +382,7 @@ void Player::Update(float fElapsedTime){
#pragma region Warrior
switch(GetState()){
case SWING_SWORD:{
case State::SWING_SWORD:{
switch(GetFacingDirection()){
case UP:{
UpdateAnimation("WARRIOR_SWINGSWORD_N");
@@ -407,9 +407,9 @@ void Player::Update(float fElapsedTime){
#pragma endregion
#pragma region Ranger
if(GetState()==SHOOT_ARROW){
if(GetState()==State::SHOOT_ARROW){
if(attack_cooldown_timer<=ARROW_ATTACK_COOLDOWN-0.3){
SetState(NORMAL);
SetState(State::NORMAL);
}
}
if(retreatTimer>0){
@@ -467,7 +467,7 @@ void Player::SetSwordSwingTimer(float val){
swordSwingTimer=val;
}
void Player::SetState(State newState){
void Player::SetState(State::State newState){
if(GetState()==State::BLOCK){
RemoveAllBuffs(BuffType::BLOCK_SLOWDOWN);
}