Add transparency effect for mismatching Z axis for bullets/monsters or if the player has iframes. Release Build 9266.
This commit is contained in:
parent
081bc71612
commit
5ef4b90b29
@ -142,16 +142,24 @@ void Bullet::_Update(const float fElapsedTime){
|
||||
}
|
||||
|
||||
void Bullet::Draw()const{
|
||||
Pixel blendCol=col;
|
||||
|
||||
blendCol.a=fadeOutTime==0?col.a:uint8_t(util::lerp(col.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime)));
|
||||
|
||||
if(GetZ()>0){
|
||||
vf2d shadowScale=vf2d{8*scale.x/3.f,1}/std::max(1.f,GetZ()/8);
|
||||
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,12*scale.y},GFX["circle.png"].Decal(),shadowScale,BLACK);
|
||||
}
|
||||
|
||||
if(game->GetPlayer()->HasIframes()||game->GetPlayer()->GetZ()>1){
|
||||
blendCol.a/=1.59f; //Comes from 255 divided by 160 which is roughly what we want the alpha to be when the bullet has full transparency.
|
||||
}
|
||||
|
||||
if(animated){
|
||||
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,scale,fadeOutTime==0?col:Pixel{col.r,col.g,col.b,uint8_t(util::lerp(col.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime)))});
|
||||
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,scale,blendCol);
|
||||
}else{
|
||||
game->view.DrawDecal(pos-vf2d{0,GetZ()}-GFX["circle.png"].Sprite()->Size()*scale/2,GFX["circle.png"].Decal(),scale,fadeOutTime==0?col:Pixel{col.r,col.g,col.b,uint8_t(util::lerp(col.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime)))});
|
||||
game->view.DrawDecal(pos-vf2d{0,GetZ()}-GFX["circle.png"].Sprite()->Size()*scale/2,GFX["circle_outline.png"].Decal(),scale,fadeOutTime==0?WHITE:Pixel{WHITE.r,WHITE.g,WHITE.b,uint8_t(util::lerp(WHITE.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime)))});
|
||||
game->view.DrawDecal(pos-vf2d{0,GetZ()}-GFX["circle.png"].Sprite()->Size()*scale/2,GFX["circle.png"].Decal(),scale,blendCol);
|
||||
game->view.DrawDecal(pos-vf2d{0,GetZ()}-GFX["circle.png"].Sprite()->Size()*scale/2,GFX["circle_outline.png"].Decal(),scale,Pixel{WHITE.r,WHITE.g,WHITE.b,blendCol.a});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,9 +397,9 @@ void Monster::Draw()const{
|
||||
if(GetZ()>0){
|
||||
vf2d shadowScale=vf2d{8*GetSizeMult()/3.f,1}/std::max(1.f,GetZ()/24);
|
||||
game->view.DrawDecal(GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
|
||||
|
||||
blendCol.a=160;
|
||||
}
|
||||
|
||||
if(game->GetPlayer()->HasIframes()||OnUpperLevel()!=game->GetPlayer()->OnUpperLevel()||abs(GetZ()-game->GetPlayer()->GetZ())>1)blendCol.a=160;
|
||||
|
||||
game->view.DrawPartialRotatedDecal(GetPos()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),spriteRot,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(!HasFourWaySprites()&&GetFacingDirection()==Direction::EAST?-1:1),GetSizeMult()),blendCol);
|
||||
if(overlaySprite.length()!=0){
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 9261
|
||||
#define VERSION_BUILD 9266
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -720,7 +720,7 @@ Monsters
|
||||
# The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator.
|
||||
IDLE = 1, 0.6, Repeat
|
||||
JUMP = 4, 0.2, Repeat
|
||||
ATTACKING = 2, 0.2, OneShot
|
||||
ATTACKING = 2, 0.2, Repeat
|
||||
DEATH = 3, 0.15, OneShot
|
||||
ATTACK = 4, 0.1, Repeat
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user