Skip to content

Commit

Permalink
Fix offset for webbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Laguna1989 committed Aug 27, 2022
1 parent 4fda757 commit 154b4a8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion impl/gamelib/laser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,32 @@ Laser::Laser(jt::Vector2f const& pos, jt::Vector2f const& velocity)
void Laser::doCreate()
{
m_glow = std::make_shared<jt::Sprite>("#g#32#150", textureManager());
m_glow->setOrigin(jt::OriginMode::CENTER);

m_glow->setColor(GP::getPalette().getColor(7));
m_shape = std::make_shared<jt::Shape>();
if (m_velocity.x == 0) {
m_shape->makeRect(jt::Vector2f { 2, 16 }, textureManager());

m_glow->setScale(jt::Vector2f { 0.3f, 1.0f });

#if JT_ENABLE_WEB
m_glow->setOrigin(jt::OriginMode::CENTER);
m_glow->setOffset(jt::Vector2f { 13, 1 });
#else
m_glow->setOrigin(jt::OriginMode::CENTER);

#endif

} else {
m_shape->makeRect(jt::Vector2f { 16, 2 }, textureManager());
m_glow->setScale(jt::Vector2f { 1.0f, 0.3f });
#if JT_ENABLE_WEB
m_glow->setOrigin(jt::OriginMode::CENTER);
m_glow->setOffset(jt::Vector2f { 1, 13 });
#else
m_glow->setOrigin(jt::OriginMode::CENTER);

#endif
}
m_shape->setOffset(jt::OffsetMode::CENTER);
m_shape->setPosition(m_initialPos);
Expand Down

0 comments on commit 154b4a8

Please sign in to comment.