Ranger configuration file implemented. Added per-step bullet collisions. Fix Release Desktop project setup.
This commit is contained in:
parent
a35e17bbc0
commit
dffca2cb5d
@ -8,7 +8,7 @@
|
|||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
|
|
||||||
Arrow::Arrow(vf2d pos,vf2d targetPos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
|
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,
|
Bullet(pos,vel,radius,damage,
|
||||||
AnimationState::ARROW,upperLevel,false,INFINITE,true,friendly,col){}
|
AnimationState::ARROW,upperLevel,false,INFINITE,true,friendly,col){}
|
||||||
|
|
||||||
|
@ -417,39 +417,49 @@ void Crawler::UpdateBullets(float fElapsedTime){
|
|||||||
Bullet*b=(*it).get();
|
Bullet*b=(*it).get();
|
||||||
b->UpdateFadeTime(fElapsedTime);
|
b->UpdateFadeTime(fElapsedTime);
|
||||||
b->Update(fElapsedTime);
|
b->Update(fElapsedTime);
|
||||||
b->pos+=b->vel*fElapsedTime;
|
|
||||||
b->animation.UpdateState(b->internal_animState,fElapsedTime);
|
b->animation.UpdateState(b->internal_animState,fElapsedTime);
|
||||||
if(!b->deactivated){
|
if(!b->deactivated){
|
||||||
if(b->friendly){
|
vf2d moveStep=b->vel*fElapsedTime;
|
||||||
for(Monster&m:MONSTER_LIST){
|
int stepCount=1;
|
||||||
if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b->pos,b->radius))){
|
if((b->vel*fElapsedTime).mag()>1){
|
||||||
if(b->hitList.find(&m)==b->hitList.end()&&m.Hurt(b->damage,b->OnUpperLevel())){
|
moveStep=(b->vel*fElapsedTime).norm();
|
||||||
if(!b->hitsMultiple){
|
stepCount=b->vel.x*fElapsedTime/moveStep.x;
|
||||||
if(b->MonsterHit(m)){
|
}
|
||||||
it=BULLET_LIST.erase(it);
|
for(;stepCount>0;stepCount--){
|
||||||
if(it==BULLET_LIST.end()){
|
b->pos+=moveStep;
|
||||||
goto outsidePlayerBulletLoop;
|
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 {
|
||||||
} else {
|
if(geom2d::overlaps(geom2d::circle(player->GetPos(),12*player->GetSizeMult()/2),geom2d::circle(b->pos,b->radius))){
|
||||||
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(player->Hurt(b->damage,b->OnUpperLevel())){
|
if(b->PlayerHit(GetPlayer())){
|
||||||
if(b->PlayerHit(GetPlayer())){
|
it=BULLET_LIST.erase(it);
|
||||||
it=BULLET_LIST.erase(it);
|
if(it==BULLET_LIST.end()){
|
||||||
if(it==BULLET_LIST.end()){
|
goto outsideBulletLoop;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
goto continueBulletLoop;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
b->pos+=b->vel*fElapsedTime;
|
||||||
}
|
}
|
||||||
if(b->pos.x+b->radius<view.GetWorldTL().x||b->pos.x-b->radius>view.GetWorldBR().x||b->pos.y+b->radius<view.GetWorldTL().y||b->pos.y-b->radius>view.GetWorldBR().y){
|
if(b->pos.x+b->radius<view.GetWorldTL().x||b->pos.x-b->radius>view.GetWorldBR().x||b->pos.y+b->radius<view.GetWorldTL().y||b->pos.y-b->radius>view.GetWorldBR().y){
|
||||||
it=BULLET_LIST.erase(it);
|
it=BULLET_LIST.erase(it);
|
||||||
@ -466,10 +476,10 @@ void Crawler::UpdateBullets(float fElapsedTime){
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
continuePlayerBulletLoop:
|
continueBulletLoop:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
outsidePlayerBulletLoop:
|
outsideBulletLoop:
|
||||||
int a;
|
int a;
|
||||||
}
|
}
|
||||||
void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel){
|
void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel){
|
||||||
@ -1152,6 +1162,8 @@ datafiledoubledata Crawler::GetDoubleList(std::string key){
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
char*testArr = new char[5000];
|
||||||
|
delete[]testArr;
|
||||||
Crawler demo;
|
Crawler demo;
|
||||||
if (demo.Construct(WINDOW_SIZE.x, WINDOW_SIZE.y, 4, 4))
|
if (demo.Construct(WINDOW_SIZE.x, WINDOW_SIZE.y, 4, 4))
|
||||||
demo.Start();
|
demo.Start();
|
||||||
|
@ -112,6 +112,12 @@
|
|||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Desktop|Win32'">
|
||||||
|
<OutDir>$(SolutionDir)$(PlatformTarget)\Release</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">
|
||||||
|
<OutDir>$(SolutionDir)$(PlatformTarget)\Release</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
@ -163,6 +163,10 @@ State Player::GetState(){
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::Knockback(vf2d vel){
|
||||||
|
this->vel+=vel;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::Update(float fElapsedTime){
|
void Player::Update(float fElapsedTime){
|
||||||
Ability&rightClickAbility=GetRightClickAbility(),
|
Ability&rightClickAbility=GetRightClickAbility(),
|
||||||
&ability=GetAbility1(),
|
&ability=GetAbility1(),
|
||||||
@ -441,7 +445,7 @@ void Player::Update(float fElapsedTime){
|
|||||||
vf2d extendedLine=pointTowardsCursor.upoint(1.1);
|
vf2d extendedLine=pointTowardsCursor.upoint(1.1);
|
||||||
float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x);
|
float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x);
|
||||||
attack_cooldown_timer=ARROW_ATTACK_COOLDOWN;
|
attack_cooldown_timer=ARROW_ATTACK_COOLDOWN;
|
||||||
BULLET_LIST.push_back(std::make_unique<Arrow>(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>(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);
|
SetAnimationBasedOnTargetingDirection(angleToCursor);
|
||||||
rapidFireTimer=RAPID_FIRE_SHOOT_DELAY;
|
rapidFireTimer=RAPID_FIRE_SHOOT_DELAY;
|
||||||
}else{
|
}else{
|
||||||
|
@ -69,6 +69,7 @@ protected:
|
|||||||
void SetZ(float z);
|
void SetZ(float z);
|
||||||
//Returns true if the move was valid and successful.
|
//Returns true if the move was valid and successful.
|
||||||
bool SetPos(vf2d pos);
|
bool SetPos(vf2d pos);
|
||||||
|
void Knockback(vf2d vel);
|
||||||
float friction=400;
|
float friction=400;
|
||||||
float attack_cooldown_timer=0;
|
float attack_cooldown_timer=0;
|
||||||
float iframe_time=0;
|
float iframe_time=0;
|
||||||
@ -86,7 +87,7 @@ protected:
|
|||||||
void PrepareCast(Ability&ability);
|
void PrepareCast(Ability&ability);
|
||||||
vf2d precastLocation={};
|
vf2d precastLocation={};
|
||||||
void SetVelocity(vf2d vel);
|
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.
|
float RETREAT_TIME="Ranger.Right Click Ability.RetreatTime"_F; //How long the Retreat ability takes.
|
||||||
const int RETREAT_GHOST_FRAMES=8;
|
const int RETREAT_GHOST_FRAMES=8;
|
||||||
const float RETREAT_GHOST_FRAME_DELAY=0.025;
|
const float RETREAT_GHOST_FRAME_DELAY=0.025;
|
||||||
@ -97,8 +98,8 @@ protected:
|
|||||||
std::vector<vf2d>ghostPositions;
|
std::vector<vf2d>ghostPositions;
|
||||||
float rapidFireTimer=0;
|
float rapidFireTimer=0;
|
||||||
int remainingRapidFireShots=0;
|
int remainingRapidFireShots=0;
|
||||||
const float RAPID_FIRE_SHOOT_DELAY=0.1;
|
const float RAPID_FIRE_SHOOT_DELAY="Ranger.Ability 1.ArrowDelay"_F;
|
||||||
const int RAPID_FIRE_SHOOT_AMOUNT=4;
|
const int RAPID_FIRE_SHOOT_AMOUNT="Ranger.Ability 1.ArrowCount"_I;
|
||||||
public:
|
public:
|
||||||
Player();
|
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
|
//So this is rather fascinating and only exists because we have the ability to change classes which means we need to initialize a class
|
||||||
|
@ -63,7 +63,9 @@ void Ranger::InitializeClassAbilities(){
|
|||||||
[](Player*p,vf2d pos={}){
|
[](Player*p,vf2d pos={}){
|
||||||
p->remainingRapidFireShots=p->RAPID_FIRE_SHOOT_AMOUNT;
|
p->remainingRapidFireShots=p->RAPID_FIRE_SHOOT_AMOUNT;
|
||||||
p->rapidFireTimer=p->RAPID_FIRE_SHOOT_DELAY;
|
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;
|
return true;
|
||||||
};
|
};
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
@ -71,9 +73,10 @@ void Ranger::InitializeClassAbilities(){
|
|||||||
Ranger::ability2.action=
|
Ranger::ability2.action=
|
||||||
[](Player*p,vf2d pos={}){
|
[](Player*p,vf2d pos={}){
|
||||||
vf2d arrowVelocity=util::pointTo(p->GetPos(),game->GetWorldMousePos());
|
vf2d arrowVelocity=util::pointTo(p->GetPos(),game->GetWorldMousePos());
|
||||||
BULLET_LIST.push_back(std::make_unique<ChargedArrow>(p->GetPos(),arrowVelocity*600,20,p->GetAttack()*2.5,p->OnUpperLevel(),true));
|
BULLET_LIST.push_back(std::make_unique<ChargedArrow>(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));
|
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;
|
return true;
|
||||||
};
|
};
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
@ -84,12 +87,16 @@ void Ranger::InitializeClassAbilities(){
|
|||||||
float shootingDist=pointTowardsCursor.length();
|
float shootingDist=pointTowardsCursor.length();
|
||||||
vf2d shootingDirMiddle=pointTowardsCursor.vector();
|
vf2d shootingDirMiddle=pointTowardsCursor.vector();
|
||||||
float shootingAngle=atan2(shootingDirMiddle.y,shootingDirMiddle.x);
|
float shootingAngle=atan2(shootingDirMiddle.y,shootingDirMiddle.x);
|
||||||
for(int i=0;i<7;i++){
|
int arrowCount="Ranger.Ability 3.ArrowCount"_I%2==0?"Ranger.Ability 3.ArrowCount"_I+1:"Ranger.Ability 3.ArrowCount"_I;
|
||||||
if(i==3)continue;
|
for(int i=0;i<arrowCount;i++){
|
||||||
float newAngle=shootingAngle-3.f/16*PI+i*1.f/16*PI;
|
if("Ranger.Ability 3.ArrowCount"_I%2==0&&i=="Ranger.Ability 3.ArrowCount"_I/2)continue;
|
||||||
|
const float halfAngle="Ranger.Ability 3.MultiShotSpread"_F*PI/180;
|
||||||
|
const float leftAngle=-halfAngle;
|
||||||
|
const float increment=halfAngle/"Ranger.Ability 3.ArrowCount"_I;
|
||||||
|
const float newAngle=shootingAngle+leftAngle/2+i*increment;
|
||||||
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
|
geom2d::line pointTowardsCursor=geom2d::line(p->GetPos(),p->GetPos()+vf2d{cos(newAngle),sin(newAngle)}*shootingDist);
|
||||||
vf2d extendedLine=pointTowardsCursor.upoint(1.1);
|
vf2d extendedLine=pointTowardsCursor.upoint(1.1);
|
||||||
BULLET_LIST.push_back(std::make_unique<Arrow>(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>(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);
|
p->SetAnimationBasedOnTargetingDirection(shootingAngle);
|
||||||
return true;
|
return true;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 935
|
#define VERSION_BUILD 959
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -6,7 +6,7 @@ Ranger
|
|||||||
{
|
{
|
||||||
DamageMult = 1
|
DamageMult = 1
|
||||||
Radius = 100
|
Radius = 100
|
||||||
Cooldown = 0.35
|
Cooldown = 0.6
|
||||||
|
|
||||||
ArrowSpd = 250
|
ArrowSpd = 250
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ Ranger
|
|||||||
# How long the retreat takes.
|
# How long the retreat takes.
|
||||||
RetreatTime = 0.2
|
RetreatTime = 0.2
|
||||||
# The distance the retreat moves the Ranger.
|
# The distance the retreat moves the Ranger.
|
||||||
RetreatDistance = 500
|
RetreatDistance = 250
|
||||||
}
|
}
|
||||||
Ability 1
|
Ability 1
|
||||||
{
|
{
|
||||||
@ -42,6 +42,20 @@ Ranger
|
|||||||
Precast Time = 0
|
Precast Time = 0
|
||||||
Casting Range = 0
|
Casting Range = 0
|
||||||
Casting Size = 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
|
Ability 2
|
||||||
{
|
{
|
||||||
@ -56,6 +70,18 @@ Ranger
|
|||||||
Precast Time = 0.3
|
Precast Time = 0.3
|
||||||
Casting Range = 0
|
Casting Range = 0
|
||||||
Casting Size = 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
|
Ability 3
|
||||||
{
|
{
|
||||||
@ -70,5 +96,18 @@ Ranger
|
|||||||
Precast Time = 0
|
Precast Time = 0
|
||||||
Casting Range = 0
|
Casting Range = 0
|
||||||
Casting Size = 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
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user