diff --git a/Crawler/Arrow.cpp b/Crawler/Arrow.cpp index 8e7acb57..bc24a2c8 100644 --- a/Crawler/Arrow.cpp +++ b/Crawler/Arrow.cpp @@ -8,7 +8,7 @@ INCLUDE_game Arrow::Arrow(vf2d pos,vf2d targetPos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col) - :finalDistance(geom2d::line(pos,targetPos).length()), + :finalDistance(geom2d::line(pos,targetPos).length()),acc(PI/2*"Ranger.Auto Attack.ArrowSpd"_F), Bullet(pos,vel,radius,damage, AnimationState::ARROW,upperLevel,false,INFINITE,true,friendly,col){} diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 1bd27385..c0701efa 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -417,39 +417,49 @@ void Crawler::UpdateBullets(float fElapsedTime){ Bullet*b=(*it).get(); b->UpdateFadeTime(fElapsedTime); b->Update(fElapsedTime); - b->pos+=b->vel*fElapsedTime; b->animation.UpdateState(b->internal_animState,fElapsedTime); if(!b->deactivated){ - if(b->friendly){ - for(Monster&m:MONSTER_LIST){ - if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b->pos,b->radius))){ - if(b->hitList.find(&m)==b->hitList.end()&&m.Hurt(b->damage,b->OnUpperLevel())){ - if(!b->hitsMultiple){ - if(b->MonsterHit(m)){ - it=BULLET_LIST.erase(it); - if(it==BULLET_LIST.end()){ - goto outsidePlayerBulletLoop; + vf2d moveStep=b->vel*fElapsedTime; + int stepCount=1; + if((b->vel*fElapsedTime).mag()>1){ + moveStep=(b->vel*fElapsedTime).norm(); + stepCount=b->vel.x*fElapsedTime/moveStep.x; + } + for(;stepCount>0;stepCount--){ + b->pos+=moveStep; + if(b->friendly){ + for(Monster&m:MONSTER_LIST){ + if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b->pos,b->radius))){ + if(b->hitList.find(&m)==b->hitList.end()&&m.Hurt(b->damage,b->OnUpperLevel())){ + if(!b->hitsMultiple){ + if(b->MonsterHit(m)){ + it=BULLET_LIST.erase(it); + if(it==BULLET_LIST.end()){ + goto outsideBulletLoop; + } } + goto continueBulletLoop; } - goto continuePlayerBulletLoop; + b->hitList[&m]=true; } - b->hitList[&m]=true; } } - } - } else { - if(geom2d::overlaps(geom2d::circle(player->GetPos(),12*player->GetSizeMult()/2),geom2d::circle(b->pos,b->radius))){ - if(player->Hurt(b->damage,b->OnUpperLevel())){ - if(b->PlayerHit(GetPlayer())){ - it=BULLET_LIST.erase(it); - if(it==BULLET_LIST.end()){ - break; + } else { + if(geom2d::overlaps(geom2d::circle(player->GetPos(),12*player->GetSizeMult()/2),geom2d::circle(b->pos,b->radius))){ + if(player->Hurt(b->damage,b->OnUpperLevel())){ + if(b->PlayerHit(GetPlayer())){ + it=BULLET_LIST.erase(it); + if(it==BULLET_LIST.end()){ + goto outsideBulletLoop; + } } + goto continueBulletLoop; } - continue; } } } + } else { + b->pos+=b->vel*fElapsedTime; } if(b->pos.x+b->radiuspos.x-b->radius>view.GetWorldBR().x||b->pos.y+b->radiuspos.y-b->radius>view.GetWorldBR().y){ it=BULLET_LIST.erase(it); @@ -466,10 +476,10 @@ void Crawler::UpdateBullets(float fElapsedTime){ } continue; } - continuePlayerBulletLoop: + continueBulletLoop: continue; } - outsidePlayerBulletLoop: + outsideBulletLoop: int a; } void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel){ @@ -1152,6 +1162,8 @@ datafiledoubledata Crawler::GetDoubleList(std::string key){ int main() { + char*testArr = new char[5000]; + delete[]testArr; Crawler demo; if (demo.Construct(WINDOW_SIZE.x, WINDOW_SIZE.y, 4, 4)) demo.Start(); diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj index eabec914..0c00ca04 100644 --- a/Crawler/Crawler.vcxproj +++ b/Crawler/Crawler.vcxproj @@ -112,6 +112,12 @@ + + $(SolutionDir)$(PlatformTarget)\Release + + + $(SolutionDir)$(PlatformTarget)\Release + Level3 diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 315b5281..b19c4384 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -163,6 +163,10 @@ State Player::GetState(){ return state; } +void Player::Knockback(vf2d vel){ + this->vel+=vel; +} + void Player::Update(float fElapsedTime){ Ability&rightClickAbility=GetRightClickAbility(), &ability=GetAbility1(), @@ -441,7 +445,7 @@ void Player::Update(float fElapsedTime){ vf2d extendedLine=pointTowardsCursor.upoint(1.1); float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); attack_cooldown_timer=ARROW_ATTACK_COOLDOWN; - BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*250,float(sin(angleToCursor)*250-PI/8*250)}+movementVelocity,12,GetAttack(),OnUpperLevel(),true))); + BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Ability 1.ArrowSpd"_F-PI/8*"Ranger.Ability 1.ArrowSpd"_F)}+movementVelocity,12*"Ranger.Ability 1.ArrowRadius"_F/100,GetAttack()*"Ranger.Ability 1.DamageMult"_F,OnUpperLevel(),true))); SetAnimationBasedOnTargetingDirection(angleToCursor); rapidFireTimer=RAPID_FIRE_SHOOT_DELAY; }else{ diff --git a/Crawler/Player.h b/Crawler/Player.h index 914c4c87..7e637e21 100644 --- a/Crawler/Player.h +++ b/Crawler/Player.h @@ -69,6 +69,7 @@ protected: void SetZ(float z); //Returns true if the move was valid and successful. bool SetPos(vf2d pos); + void Knockback(vf2d vel); float friction=400; float attack_cooldown_timer=0; float iframe_time=0; @@ -86,7 +87,7 @@ protected: void PrepareCast(Ability&ability); vf2d precastLocation={}; void SetVelocity(vf2d vel); - const float RETREAT_DISTANCE=122.5*"Ranger.Right Click Ability.RetreatDistance"_F/100; + const float RETREAT_DISTANCE=24*"Ranger.Right Click Ability.RetreatDistance"_F/100; float RETREAT_TIME="Ranger.Right Click Ability.RetreatTime"_F; //How long the Retreat ability takes. const int RETREAT_GHOST_FRAMES=8; const float RETREAT_GHOST_FRAME_DELAY=0.025; @@ -97,8 +98,8 @@ protected: std::vectorghostPositions; float rapidFireTimer=0; int remainingRapidFireShots=0; - const float RAPID_FIRE_SHOOT_DELAY=0.1; - const int RAPID_FIRE_SHOOT_AMOUNT=4; + const float RAPID_FIRE_SHOOT_DELAY="Ranger.Ability 1.ArrowDelay"_F; + const int RAPID_FIRE_SHOOT_AMOUNT="Ranger.Ability 1.ArrowCount"_I; public: Player(); //So this is rather fascinating and only exists because we have the ability to change classes which means we need to initialize a class diff --git a/Crawler/Ranger.cpp b/Crawler/Ranger.cpp index 60caeb5b..fa2d3dca 100644 --- a/Crawler/Ranger.cpp +++ b/Crawler/Ranger.cpp @@ -63,7 +63,9 @@ void Ranger::InitializeClassAbilities(){ [](Player*p,vf2d pos={}){ p->remainingRapidFireShots=p->RAPID_FIRE_SHOOT_AMOUNT; p->rapidFireTimer=p->RAPID_FIRE_SHOOT_DELAY; - p->SetState(State::ANIMATION_LOCK); + if("Ranger.Ability 1.IsAnimationLocked"_I){ + p->SetState(State::ANIMATION_LOCK); + } return true; }; #pragma endregion @@ -71,9 +73,10 @@ void Ranger::InitializeClassAbilities(){ Ranger::ability2.action= [](Player*p,vf2d pos={}){ vf2d arrowVelocity=util::pointTo(p->GetPos(),game->GetWorldMousePos()); - BULLET_LIST.push_back(std::make_unique(p->GetPos(),arrowVelocity*600,20,p->GetAttack()*2.5,p->OnUpperLevel(),true)); + BULLET_LIST.push_back(std::make_unique(p->GetPos(),arrowVelocity*"Ranger.Ability 2.Speed"_F,12*"Ranger.Ability 2.Radius"_F/100,p->GetAttack()*"Ranger.Ability 2.DamageMult"_F,p->OnUpperLevel(),true)); p->SetAnimationBasedOnTargetingDirection(atan2(arrowVelocity.y,arrowVelocity.x)); - game->SetupWorldShake(0.3); + game->SetupWorldShake("Ranger.Ability 2.WorldShakeTime"_F); + p->Knockback(-1.f*arrowVelocity.norm()*"Ranger.Ability 2.Knockback"_F); return true; }; #pragma endregion @@ -84,12 +87,16 @@ void Ranger::InitializeClassAbilities(){ float shootingDist=pointTowardsCursor.length(); vf2d shootingDirMiddle=pointTowardsCursor.vector(); float shootingAngle=atan2(shootingDirMiddle.y,shootingDirMiddle.x); - for(int i=0;i<7;i++){ - if(i==3)continue; - float newAngle=shootingAngle-3.f/16*PI+i*1.f/16*PI; + int arrowCount="Ranger.Ability 3.ArrowCount"_I%2==0?"Ranger.Ability 3.ArrowCount"_I+1:"Ranger.Ability 3.ArrowCount"_I; + for(int i=0;iGetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist); vf2d extendedLine=pointTowardsCursor.upoint(1.1); - BULLET_LIST.push_back(std::make_unique(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*250,float(sin(newAngle)*250-PI/8*250)}+p->movementVelocity,12,p->GetAttack(),p->OnUpperLevel(),true))); + BULLET_LIST.push_back(std::make_unique(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,p->GetAttack()*"Ranger.Ability 3.DamageMult"_F,p->OnUpperLevel(),true))); } p->SetAnimationBasedOnTargetingDirection(shootingAngle); return true; diff --git a/Crawler/Version.h b/Crawler/Version.h index a83f15d5..7fd97717 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 935 +#define VERSION_BUILD 959 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/classes/Ranger.txt b/Crawler/assets/config/classes/Ranger.txt index 4e18b669..9263e38c 100644 --- a/Crawler/assets/config/classes/Ranger.txt +++ b/Crawler/assets/config/classes/Ranger.txt @@ -6,7 +6,7 @@ Ranger { DamageMult = 1 Radius = 100 - Cooldown = 0.35 + Cooldown = 0.6 ArrowSpd = 250 } @@ -27,7 +27,7 @@ Ranger # How long the retreat takes. RetreatTime = 0.2 # The distance the retreat moves the Ranger. - RetreatDistance = 500 + RetreatDistance = 250 } Ability 1 { @@ -42,6 +42,20 @@ Ranger Precast Time = 0 Casting Range = 0 Casting Size = 0 + + # Damage multiplier per shot + DamageMult = 1.0 + # Speed of arrows that Rapid Fire shoots out. + ArrowSpd = 300 + # Number of arrows Rapid Fire shoots out. + ArrowCount = 4 + # Amount of time between each arrow shot. + ArrowDelay = 0.1 + # Whether or not this ability locks you in place. (0=Not Locked) + IsAnimationLocked = 1 + + # Hitbox radius of the arrows + ArrowRadius = 100 } Ability 2 { @@ -56,6 +70,18 @@ Ranger Precast Time = 0.3 Casting Range = 0 Casting Size = 0 + + # The amount of knockback that this ability causes. + Knockback = 200 + # Speed of the charged arrow shot. + Speed = 600 + # Radius of the shot. + Radius = 166.6667 + # Damage Multiplier of the charged shot. + DamageMult = 2.5 + + # How long the world shakes upon using this ability. + WorldShakeTime = 0.3 } Ability 3 { @@ -70,5 +96,18 @@ Ranger Precast Time = 0 Casting Range = 0 Casting Size = 0 + + # Damage multiplier per shot + DamageMult = 1.0 + # Number of arrows in the shot spread. + ArrowCount = 6 + # How far the shot spread in one angle is. For example, if the value here is set to 18.375, then Multi shot divides the arrows evenly from a span of -18.375 degrees to the left to 18.375 degrees to the right of the player. + MultiShotSpread = 18.375 + # Speed of arrows that Rapid Fire shoots out. + ArrowSpd = 300 + + # Hitbox radius of the arrows + ArrowRadius = 100 + } } \ No newline at end of file diff --git a/x64/Release Desktop/Crawler.exe b/x64/Release Desktop/Crawler.exe deleted file mode 100644 index 3ea0ee63..00000000 Binary files a/x64/Release Desktop/Crawler.exe and /dev/null differ diff --git a/x64/Release/Crawler.exe b/x64/Release/Crawler.exe index 39ed6bbb..0f8b703b 100644 Binary files a/x64/Release/Crawler.exe and b/x64/Release/Crawler.exe differ