Monster water reflections implemented.
This commit is contained in:
parent
4631733497
commit
ba8a1bd091
@ -603,7 +603,11 @@ void Crawler::RenderWorld(float fElapsedTime){
|
||||
float multiplierX=0.9;
|
||||
multiplierX*=(1-abs(sin(reflectionStepTime))*"water_reflection_scale_factor"_F);
|
||||
multiplierX*=(1-abs(cos(1.5*reflectionStepTime))*"water_reflection_scale_factor"_F);
|
||||
RenderPlayer(player->GetPos()+vf2d{abs(sin(reflectionStepTime))*"water_reflection_scale_factor"_F*player->GetFrame().GetSourceRect().size.x,float(player->GetFrame().GetSourceRect().size.y)-8}*player->GetSizeMult(),{multiplierX,-1});
|
||||
float reflectionRatioX=abs(sin(reflectionStepTime))*"water_reflection_scale_factor"_F;
|
||||
RenderPlayer(player->GetPos()+vf2d{reflectionRatioX*player->GetFrame().GetSourceRect().size.x,float(player->GetFrame().GetSourceRect().size.y)-8}*player->GetSizeMult(),{multiplierX,-1});
|
||||
for(Monster&m:MONSTER_LIST){
|
||||
m.DrawReflection(reflectionRatioX,multiplierX);
|
||||
}
|
||||
SetDecalMode(DecalMode::NORMAL);
|
||||
}
|
||||
for (int x = view.GetTopLeftTile().x/24-1; x <= view.GetBottomRightTile().x/24; x++){
|
||||
|
@ -188,11 +188,12 @@ void Monster::Draw(){
|
||||
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()},game->GFX_Circle.Decal(),shadowScale,BLACK);
|
||||
}
|
||||
if(GetFacingDirection()==RIGHT){
|
||||
game->view.DrawPartialDecal((GetPos()+vf2d{float(GetFrame().GetSourceRect().size.x),0}*GetSizeMult())-vf2d{12,12}*GetSizeMult()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*-1,GetSizeMult()),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
|
||||
} else {
|
||||
game->view.DrawPartialDecal(GetPos()-vf2d{12,12}*GetSizeMult()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult(),GetSizeMult()),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
|
||||
}
|
||||
game->view.DrawPartialRotatedDecal(GetPos()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(GetFacingDirection()==RIGHT?-1:1),GetSizeMult()),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
|
||||
}
|
||||
void Monster::DrawReflection(float drawRatioX,float multiplierX){
|
||||
game->SetDecalMode(DecalMode::ADDITIVE);
|
||||
game->view.DrawPartialRotatedDecal(GetPos()+vf2d{drawRatioX*GetFrame().GetSourceRect().size.x,GetZ()+(GetFrame().GetSourceRect().size.y-16)*GetSizeMult()},GetFrame().GetSourceImage()->Decal(),0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(GetFacingDirection()==RIGHT?-1:1)*multiplierX,GetSizeMult()*-1),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
|
||||
game->SetDecalMode(DecalMode::NORMAL);
|
||||
}
|
||||
void Monster::Collision(Player*p){
|
||||
if(MONSTER_DATA[id].GetCollisionDmg()>0&&!hasHitPlayer){
|
||||
|
@ -112,6 +112,7 @@ public:
|
||||
vf2d&GetTargetPos();
|
||||
Key GetFacingDirection();
|
||||
void Draw();
|
||||
void DrawReflection(float drawRatioX,float multiplierX);
|
||||
void Collision(Player*p);
|
||||
void Collision(Monster&p);
|
||||
void Collision();
|
||||
|
@ -348,7 +348,6 @@ void Player::Update(float fElapsedTime){
|
||||
SetState(State::NORMAL);
|
||||
castInfo.castTimer=castInfo.castTotalTime=0;
|
||||
}
|
||||
|
||||
if(AllowedToCast(ability)&&ability.action(this,{})){
|
||||
ability.cooldown=ability.COOLDOWN_TIME;
|
||||
mana-=ability.manaCost;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 1283
|
||||
#define VERSION_BUILD 1293
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="9" nextobjectid="130">
|
||||
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="205" height="205" tilewidth="24" tileheight="24" infinite="0" backgroundcolor="#475500" nextlayerid="9" nextobjectid="134">
|
||||
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
|
||||
<tileset firstgid="2913" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
|
||||
<tileset firstgid="4533" source="../maps/24x24_Waterfall.tsx"/>
|
||||
@ -1961,6 +1961,23 @@
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="129" name="Player Spawn" type="PlayerSpawnLocation" x="600" y="4248" width="24" height="24"/>
|
||||
<object id="130" name="Player Spawn" type="PlayerSpawnLocation" x="3192" y="4248" width="24" height="24"/>
|
||||
<object id="131" name="Temporary" type="SpawnGroup" x="3150" y="4188" width="114" height="246">
|
||||
<ellipse/>
|
||||
</object>
|
||||
<object id="132" type="Monster" x="3174" y="4350">
|
||||
<properties>
|
||||
<property name="Type" type="int" propertytype="MonsterName" value="1"/>
|
||||
<property name="spawner" type="object" value="131"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
<object id="133" type="Monster" x="3240" y="4302">
|
||||
<properties>
|
||||
<property name="Type" type="int" propertytype="MonsterName" value="3"/>
|
||||
<property name="spawner" type="object" value="131"/>
|
||||
</properties>
|
||||
<point/>
|
||||
</object>
|
||||
</objectgroup>
|
||||
</map>
|
||||
|
Loading…
x
Reference in New Issue
Block a user