|
|
|
@ -54,6 +54,8 @@ bool Crawler::OnUserCreate(){ |
|
|
|
|
GFX_SonicSlash.Load("assets/sonicslash.png"); |
|
|
|
|
GFX_BulletCircle.Load("assets/circle.png"); |
|
|
|
|
GFX_BulletCircleOutline.Load("assets/circle_outline.png"); |
|
|
|
|
GFX_EnergyBolt.Load("assets/energy_bolt.png"); |
|
|
|
|
GFX_EnergyParticle.Load("assets/energy_particle.png"); |
|
|
|
|
|
|
|
|
|
//Animations
|
|
|
|
|
InitializeAnimations(); |
|
|
|
@ -284,7 +286,7 @@ void Crawler::InitializeAnimations(){ |
|
|
|
|
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_S]=pl_wizard_attack_s; |
|
|
|
|
Animate2D::FrameSequence pl_wizard_attack_e(0.2); |
|
|
|
|
for(int i=0;i<3;i++){ |
|
|
|
|
pl_wizard_attack_e.AddFrame({&GFX_Wizard_Sheet,{vi2d{4,3}*24,{24,24}}}); |
|
|
|
|
pl_wizard_attack_e.AddFrame({&GFX_Wizard_Sheet,{vi2d{4+i,3}*24,{24,24}}}); |
|
|
|
|
if(i==1){ |
|
|
|
|
pl_wizard_attack_e.AddFrame({&GFX_Wizard_Sheet,{vi2d{4,3}*24,{24,24}}}); |
|
|
|
|
} |
|
|
|
@ -292,7 +294,7 @@ void Crawler::InitializeAnimations(){ |
|
|
|
|
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_E]=pl_wizard_attack_e; |
|
|
|
|
Animate2D::FrameSequence pl_wizard_attack_w(0.2); |
|
|
|
|
for(int i=0;i<3;i++){ |
|
|
|
|
pl_wizard_attack_w.AddFrame({&GFX_Wizard_Sheet,{vi2d{4,2}*24,{24,24}}}); |
|
|
|
|
pl_wizard_attack_w.AddFrame({&GFX_Wizard_Sheet,{vi2d{4+i,2}*24,{24,24}}}); |
|
|
|
|
if(i==1){ |
|
|
|
|
pl_wizard_attack_w.AddFrame({&GFX_Wizard_Sheet,{vi2d{4,2}*24,{24,24}}}); |
|
|
|
|
} |
|
|
|
@ -300,7 +302,7 @@ void Crawler::InitializeAnimations(){ |
|
|
|
|
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_W]=pl_wizard_attack_w; |
|
|
|
|
Animate2D::FrameSequence pl_wizard_attack_n(0.2); |
|
|
|
|
for(int i=0;i<3;i++){ |
|
|
|
|
pl_wizard_attack_n.AddFrame({&GFX_Wizard_Sheet,{vi2d{4,1}*24,{24,24}}}); |
|
|
|
|
pl_wizard_attack_n.AddFrame({&GFX_Wizard_Sheet,{vi2d{4+i,1}*24,{24,24}}}); |
|
|
|
|
if(i==1){ |
|
|
|
|
pl_wizard_attack_n.AddFrame({&GFX_Wizard_Sheet,{vi2d{4,1}*24,{24,24}}}); |
|
|
|
|
} |
|
|
|
@ -340,6 +342,15 @@ void Crawler::InitializeAnimations(){ |
|
|
|
|
sonicslash_effect.AddFrame({&GFX_SonicSlash,{{i*60,0},{60,60}}}); |
|
|
|
|
} |
|
|
|
|
ANIMATION_DATA[AnimationState::SONICSLASH]=sonicslash_effect; |
|
|
|
|
Animate2D::FrameSequence energy_bolt; |
|
|
|
|
energy_bolt.AddFrame({&GFX_EnergyBolt,{{0,0},{24,24}}}); |
|
|
|
|
ANIMATION_DATA[AnimationState::ENERGY_BOLT]=energy_bolt; |
|
|
|
|
|
|
|
|
|
Animate2D::FrameSequence energy_particle; |
|
|
|
|
for(int i=0;i<3;i++){ |
|
|
|
|
energy_particle.AddFrame({&GFX_EnergyParticle,{{i*3,0},{3,3}}}); |
|
|
|
|
} |
|
|
|
|
ANIMATION_DATA[AnimationState::ENERGY_PARTICLE]=energy_particle; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Crawler::LeftHeld(){ |
|
|
|
@ -582,6 +593,7 @@ void Crawler::UpdateEffects(float fElapsedTime){ |
|
|
|
|
void Crawler::UpdateBullets(float fElapsedTime){ |
|
|
|
|
for(std::vector<Bullet>::iterator it=BULLET_LIST.begin();it!=BULLET_LIST.end();++it){ |
|
|
|
|
Bullet&b=*it; |
|
|
|
|
b.Update(fElapsedTime); |
|
|
|
|
b.pos+=b.vel*fElapsedTime; |
|
|
|
|
if(geom2d::overlaps(geom2d::circle(player.GetPos(),12*player.GetSizeMult()/2),geom2d::circle(b.pos,b.radius))){ |
|
|
|
|
if(player.Hurt(b.damage)){ |
|
|
|
@ -608,6 +620,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
for(std::vector<Bullet>::iterator it=PLAYER_BULLET_LIST.begin();it!=PLAYER_BULLET_LIST.end();++it){ |
|
|
|
|
Bullet&b=*it; |
|
|
|
|
b.Update(fElapsedTime); |
|
|
|
|
b.pos+=b.vel*fElapsedTime; |
|
|
|
|
for(Monster&m:MONSTER_LIST){ |
|
|
|
|
if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b.pos,b.radius))){ |
|
|
|
@ -615,7 +628,7 @@ void Crawler::UpdateBullets(float fElapsedTime){ |
|
|
|
|
if(!b.hitsMultiple){ |
|
|
|
|
it=PLAYER_BULLET_LIST.erase(it); |
|
|
|
|
if(it==PLAYER_BULLET_LIST.end()){ |
|
|
|
|
break; |
|
|
|
|
goto outsidePlayerBulletLoop; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
b.hitList[&m]=true; |
|
|
|
@ -637,6 +650,8 @@ void Crawler::UpdateBullets(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
b.animation.UpdateState(b.internal_animState,fElapsedTime); |
|
|
|
|
} |
|
|
|
|
outsidePlayerBulletLoop: |
|
|
|
|
int a; |
|
|
|
|
} |
|
|
|
|
void Crawler::HurtEnemies(vf2d pos,float radius,int damage){ |
|
|
|
|
for(Monster&m:MONSTER_LIST){ |
|
|
|
|