| 189 | } |
| 190 | |
| 191 | void Issue2572::update(float dt) |
| 192 | { |
| 193 | _addTimer += dt; |
| 194 | _moveTimer += dt; |
| 195 | if (_moveTimer >= _wholeMoveTime) |
| 196 | { |
| 197 | this->unscheduleUpdate(); |
| 198 | return; |
| 199 | } |
| 200 | |
| 201 | _paraNode->setPosition(_paraNode->getPosition() + _wholeMoveSize * dt / _wholeMoveTime); |
| 202 | |
| 203 | if (_addTimer >= _addChildStep) |
| 204 | { |
| 205 | _addTimer = 0.0f; |
| 206 | |
| 207 | auto child = Sprite::create("Images/Icon.png"); |
| 208 | Size viewSize = Director::getInstance()->getVisibleSize(); |
| 209 | Vec2 offset = Vec2(viewSize.width / 2, viewSize.height / 2); |
| 210 | _paraNode->addChild(child, 1, Vec2(1, 0), offset); |
| 211 | |
| 212 | _childList.pushBack(child); |
| 213 | } |
| 214 | |
| 215 | // After a child added, output the position of the children 3 times. |
| 216 | // Bug : The first output is much different with the second one & the third one. |
| 217 | if (_childList.size() != _preListSize) |
| 218 | { |
| 219 | switch (_printCount) |
| 220 | { |
| 221 | case 0: |
| 222 | case 1: |
| 223 | case 2: |
| 224 | AXLOGD("--child count-- {}", _childList.size()); |
| 225 | for (const auto& obj : _childList) |
| 226 | { |
| 227 | Sprite* obstacle = dynamic_cast<Sprite*>(obj); |
| 228 | AXLOGD("child position : ({:.2}, {:.2})", obstacle->getPositionX(), obstacle->getPositionY()); |
| 229 | } |
| 230 | AXLOGD("-------------------"); |
| 231 | _printCount++; |
| 232 | break; |
| 233 | case 3: |
| 234 | _preListSize = _childList.size(); |
| 235 | _printCount = 0; |
| 236 | break; |
| 237 | default: |
| 238 | break; |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | std::string Issue2572::title() const |
| 244 | { |
nothing calls this directly
no test coverage detected