void GiantSlimeEntity::render(sf::RenderTarget* app) { if (!isDying) { // shadow sprite.setPosition(x, y); if (isMirroring) sprite.setTextureRect(sf::IntRect(shadowFrame * width + width, 0, -width, height)); else sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } sprite.setPosition(x, y - h); if (isMirroring) sprite.setTextureRect(sf::IntRect(frame * width + width, 0, -width, height)); else sprite.setTextureRect(sf::IntRect(frame * width, 0, width, height)); app->draw(sprite); renderLifeBar(app, tools::getLabel("enemy_giant_slime")); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void SlimePetEntity::render(sf::RenderTarget* app) { // shadow if (h < 1055) { int fade = 255; if (h > 800) fade = - (h - 1055); sprite.setColor(sf::Color(255, 255, 255, fade)); sprite.setPosition(x, y); sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); sprite.setColor(sf::Color(255, 255, 255, 255)); } // sprite sprite.setPosition(x, y - h); sprite.setTextureRect(sf::IntRect(frame * width, 4 * height, width, height)); app->draw(sprite); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void LargeSlimeEntity::render(sf::RenderTarget* app) { if (!isDying) { // shadow sprite.setPosition(x, y); if (isMirroring) sprite.setTextureRect(sf::IntRect(shadowFrame * width + width, 0, -width, height)); else sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } sprite.setPosition(x, y - h); if (isMirroring) sprite.setTextureRect(sf::IntRect( (frame % 5) * width + width, (frame / 5) * height, -width, height)); else sprite.setTextureRect(sf::IntRect((frame % 5) * width, (frame / 5) * height, width, height)); app->draw(sprite); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void ItemEntity::render(sf::RenderTarget* app) { // shadow if (itemType < FirstEquipItem) { sprite.setTextureRect(sf::IntRect(9 * width, 3 * height, width, height)); sprite.setPosition(x, y + 3); app->draw(sprite); sprite.setPosition(x, y); } else { sprite.setTextureRect(sf::IntRect(9 * width, 7 * height, width, height)); app->draw(sprite); } // price if (isMerchandise) { std::ostringstream oss; oss << getPrice(); sf::Color fontColor; if (getPrice() > game().getPlayer()->getGold()) fontColor = sf::Color(215, 20, 20); else fontColor = sf::Color(255, 255, 255); game().write(oss.str(), 16, x, y + 35.0f, ALIGN_CENTER, fontColor, app, 1 , 1, 0); } if (itemType < FirstEquipItem && itemType >= ItemPotion01 + NUMBER_UNIDENTIFIED) { float yItem = h > 0.1f ? y - h : y; int frameBottle = game().getPotion(itemType); sprite.setPosition(x, yItem); sprite.setTextureRect(sf::IntRect(frameBottle % imagesProLine * width, frameBottle / imagesProLine * height, width, height)); app->draw(sprite); sprite.setTextureRect(sf::IntRect(frame % imagesProLine * width, frame / imagesProLine * height, width, height)); app->draw(sprite); sprite.setPosition(x, y); } else if (h > 0.1f) { sprite.setTextureRect(sf::IntRect(frame % imagesProLine * width, frame / imagesProLine * height, width, height)); sprite.setPosition(x, y - h); app->draw(sprite); sprite.setPosition(x, y); } else CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void ChestEntity::render(sf::RenderTarget* app) { CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void BaseCreatureEntity::render(sf::RenderTarget* app) { if (!isDying && shadowFrame > -1) { // shadow sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void ChestEntity::render(sf::RenderTarget* app) { if (appearTimer > 0.0f) { int fade = 255 * (1.0f - appearTimer / CHEST_APPEAR_DELAY); sprite.setColor(sf::Color(255, 255, 255, fade)); } else sprite.setColor(sf::Color(255, 255, 255, 255)); CollidingSpriteEntity::render(app); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }
void SausageEntity::render(sf::RenderTarget* app) { if (!isDying && shadowFrame > -1) { // shadow sprite.setPosition(x, y); sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height)); app->draw(sprite); } sprite.setPosition(x, y - h); sprite.setTextureRect(sf::IntRect(frame * width, 0, width, height)); app->draw(sprite); if (game().getShowLogical()) { displayBoundingBox(app); displayCenterAndZ(app); } }