Fixed Range indicator issues and reduced attack range stat to be 2 per point.
This commit is contained in:
parent
d233afe975
commit
88d9dea027
@ -14,6 +14,15 @@ Attack Speed: 1/(AtkSpd/2) attacks per second
|
|||||||
Range/Attack indicators
|
Range/Attack indicators
|
||||||
|
|
||||||
System has limited resources, both sides fight for resources.
|
System has limited resources, both sides fight for resources.
|
||||||
|
Add Bar
|
||||||
|
Quantify Resource Limits
|
||||||
|
|
||||||
|
Start off w/5 of each resource.
|
||||||
|
|
||||||
|
Player build Memory Allocators using Resources.
|
||||||
|
(HEALTH,RANGE,ATKSPD,MOVESPD,PROCEDURE)
|
||||||
|
Memory Allocator costs 1/1/1/1/1.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Tutorial
|
Tutorial
|
||||||
|
@ -28,7 +28,7 @@ BasicUnit2::BasicUnit2(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAG
|
|||||||
},pos,*IMAGES[VIRUS_IMG1],friendly,moveable){}
|
},pos,*IMAGES[VIRUS_IMG1],friendly,moveable){}
|
||||||
|
|
||||||
void BasicUnit2::Attack(Unit&victim){
|
void BasicUnit2::Attack(Unit&victim){
|
||||||
|
victim>>=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LeftShifter::LeftShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable)
|
LeftShifter::LeftShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable)
|
||||||
@ -41,7 +41,7 @@ LeftShifter::LeftShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IM
|
|||||||
},pos,*IMAGES[LEFT_SHIFTER],friendly,moveable){}
|
},pos,*IMAGES[LEFT_SHIFTER],friendly,moveable){}
|
||||||
|
|
||||||
void LeftShifter::Attack(Unit&victim){
|
void LeftShifter::Attack(Unit&victim){
|
||||||
|
victim<<=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RightShifter::RightShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable)
|
RightShifter::RightShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable)
|
||||||
@ -54,7 +54,7 @@ RightShifter::RightShifter(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&
|
|||||||
},pos,*IMAGES[RIGHT_SHIFTER],friendly,moveable){}
|
},pos,*IMAGES[RIGHT_SHIFTER],friendly,moveable){}
|
||||||
|
|
||||||
void RightShifter::Attack(Unit&victim){
|
void RightShifter::Attack(Unit&victim){
|
||||||
|
victim>>=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitRestorer::BitRestorer(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable)
|
BitRestorer::BitRestorer(vf2d pos,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,bool friendly,bool moveable)
|
||||||
@ -266,8 +266,6 @@ void Unit::_Update(PixelGameEngine*pge){
|
|||||||
auto ptrTarget=target.lock();
|
auto ptrTarget=target.lock();
|
||||||
if(!InRange(ptrTarget)){
|
if(!InRange(ptrTarget)){
|
||||||
SetPos(GetPos()+(ptrTarget->GetPos()-pos).norm()*GetMoveSpd()*24*pge->GetElapsedTime());
|
SetPos(GetPos()+(ptrTarget->GetPos()-pos).norm()*GetMoveSpd()*24*pge->GetElapsedTime());
|
||||||
} else {
|
|
||||||
//TODO Attack here.
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
if(targetLoc!=CONSTANT::UNSELECTED){
|
if(targetLoc!=CONSTANT::UNSELECTED){
|
||||||
@ -366,13 +364,19 @@ void Unit::SetTargetLocation(vf2d targetLoc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::InRange(std::shared_ptr<Unit>target){
|
bool Unit::InRange(std::shared_ptr<Unit>target){
|
||||||
float dist=geom2d::line(GetPos(),target->GetPos()).length();
|
return InRange(target.get());
|
||||||
return dist<24*(GetRange()+1);
|
}
|
||||||
|
|
||||||
|
bool Unit::InRange(Unit*target){
|
||||||
|
float range=12*(GetRange()+1);
|
||||||
|
float totalRange=GetUnitSize().x/2+range;
|
||||||
|
return geom2d::overlaps(geom2d::circle<float>{GetPos(),totalRange},geom2d::circle<float>{target->GetPos(),target->GetUnitSize().x/2});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::InRange(vf2d pos){
|
bool Unit::InRange(vf2d pos){
|
||||||
float dist=geom2d::line(GetPos(),pos).length();
|
float range=12*(GetRange()+1);
|
||||||
return dist<24*(GetRange()+1);
|
float totalRange=GetUnitSize().x/2+range;
|
||||||
|
return geom2d::overlaps(geom2d::circle<float>{GetPos(),totalRange},geom2d::circle<float>{pos,0.1});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::SetPos(vf2d newPos){
|
void Unit::SetPos(vf2d newPos){
|
||||||
@ -395,7 +399,7 @@ void Unit::AttemptAttack(Unit*unit){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(finalTarget!=nullptr){
|
if(finalTarget!=nullptr){
|
||||||
if(InRange(finalTarget->GetPos())){
|
if(InRange(finalTarget)){
|
||||||
_Attack(finalTarget); //Call the parent function first, followed by the child.
|
_Attack(finalTarget); //Call the parent function first, followed by the child.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,7 @@ private:
|
|||||||
bool selected=false;
|
bool selected=false;
|
||||||
bool dead=false;
|
bool dead=false;
|
||||||
bool InRange(std::shared_ptr<Unit>target);
|
bool InRange(std::shared_ptr<Unit>target);
|
||||||
|
bool InRange(Unit*target);
|
||||||
bool InRange(vf2d pos);
|
bool InRange(vf2d pos);
|
||||||
float reloadTimer=0;
|
float reloadTimer=0;
|
||||||
void _Attack(Unit*finalTarget);
|
void _Attack(Unit*finalTarget);
|
||||||
|
@ -61,6 +61,8 @@ bool VirusAttack::OnUserCreate(){
|
|||||||
collectionPoints.push_back(std::make_unique<CollectionPoint>(this,vf2d{32.f,32.f+48*i},-PI/2,*IMAGES[MEMORY_COLLECTION_POINT],MemoryType(i)));
|
collectionPoints.push_back(std::make_unique<CollectionPoint>(this,vf2d{32.f,32.f+48*i},-PI/2,*IMAGES[MEMORY_COLLECTION_POINT],MemoryType(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
units.push_back(std::make_unique<RAMBank>(this,vf2d{320,320},IMAGES,false));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +165,10 @@ void VirusAttack::DrawMinimap(){
|
|||||||
Clear(BLANK);
|
Clear(BLANK);
|
||||||
DrawRect((game.GetWorldOffset()/worldPixelSize*64),viewingTilesPct*64/game.GetWorldScale());
|
DrawRect((game.GetWorldOffset()/worldPixelSize*64),viewingTilesPct*64/game.GetWorldScale());
|
||||||
for(auto&u:units){
|
for(auto&u:units){
|
||||||
FillRect(u->GetGhostPos()/worldPixelSize*64,vf2d{2,2}*u->GetUnitSize()/24,u->IsFriendly()?GREEN:RED);
|
vf2d squareSize=u->GetUnitSize()/vf2d(CONSTANT::WORLD_SIZE);
|
||||||
|
squareSize.x=std::round(std::max(1.f,squareSize.x));
|
||||||
|
squareSize.y=std::round(std::max(1.f,squareSize.y));
|
||||||
|
FillRect(u->GetGhostPos()/worldPixelSize*64-squareSize,squareSize*2,u->IsFriendly()?GREEN:RED);
|
||||||
}
|
}
|
||||||
IMAGES[MINIMAP_OUTLINE]->Decal()->Update();
|
IMAGES[MINIMAP_OUTLINE]->Decal()->Update();
|
||||||
SetDrawTarget(nullptr);
|
SetDrawTarget(nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user