| 82 | } |
| 83 | |
| 84 | void GroundLayer::update(float dt) |
| 85 | { |
| 86 | if (auto pl = BaseGameLayer::getInstance()) |
| 87 | { |
| 88 | if (pl->_colorChannels.contains(1001)) _sprite->setColor(pl->_colorChannels.at(1001)._color); |
| 89 | } |
| 90 | |
| 91 | this->_sprite->setPositionX(this->_sprite->getPositionX() - dt * this->m_fSpeed); |
| 92 | |
| 93 | if (this->_sprite->getPositionX() <= -128.0f) this->_sprite->setPositionX(0); |
| 94 | if (this->_sprite->getPositionX() >= 64.0f) this->_sprite->setPositionX(-64); |
| 95 | } |
| 96 | |
| 97 | GroundLayer* GroundLayer::create(int groundID) |
| 98 | { |