void SpriteRenderer::updateSpritePositions(IN const ProcessInfo& info) { initSprites(vertexes.size()/4, set->particles.size()); cameraPosition = info.camera.getPosition(); int cnt = set->particles.size(); for(int i = 0; i < cnt; i++) { int i4 = i*4; v3 dx; v3 dy; calculateSprite(info.camera, set->particles[i]->position, POSITION_GLOBAL, v2(set->particles[i]->size, set->particles[i]->size), align, customAlign, vertexes[i4 + 0], vertexes[i4 + 1], vertexes[i4 + 2], vertexes[i4 + 3], normals[i4 + 0], dx, dy); normals[i4 + 1] = normals[i4 + 2] = normals[i4 + 3] = normals[i4 + 0]; if (life_blend) { texCoords2[i*4 + 0].x = texCoords2[i*4 + 1].x = texCoords2[i*4 + 2].x = texCoords2[i*4 + 3].x = clamp(set->particles[i]->life); texCoords2[i*4 + 0].y = texCoords2[i*4 + 1].y = texCoords2[i*4 + 2].y = texCoords2[i*4 + 3].y = 0.0; } } }
void Friend::update(float delta){ if(moving){ position += MathVector::scale(movement, delta); if(std::fabs(target.x - position.x) + std::fabs(target.y - position.y) < 0.3f){ newAction(); } } setPosition(sf::Vector2f(position.x, position.y)); calculateSprite(delta, &movement, moving); alarm->update(delta); }