Change which events are transparent

This commit is contained in:
Diegoisawesome 2019-01-10 00:46:32 -06:00
parent 668c0b65ac
commit fde8a694aa
4 changed files with 5 additions and 1 deletions

View file

@ -79,6 +79,7 @@ public:
QPixmap pixmap; QPixmap pixmap;
int spriteWidth; int spriteWidth;
int spriteHeight; int spriteHeight;
bool usingSprite;
}; };
#endif // EVENT_H #endif // EVENT_H

View file

@ -14,6 +14,7 @@ Event::Event()
{ {
this->spriteWidth = 16; this->spriteWidth = 16;
this->spriteHeight = 16; this->spriteHeight = 16;
this->usingSprite = false;
} }
Event* Event::createNewEvent(QString event_type, QString map_name) Event* Event::createNewEvent(QString event_type, QString map_name)
@ -242,4 +243,5 @@ void Event::setPixmapFromSpritesheet(QImage spritesheet, int spriteWidth, int sp
pixmap = QPixmap::fromImage(img); pixmap = QPixmap::fromImage(img);
this->spriteWidth = spriteWidth; this->spriteWidth = spriteWidth;
this->spriteHeight = spriteHeight; this->spriteHeight = spriteHeight;
this->usingSprite = true;
} }

View file

@ -711,7 +711,7 @@ void Editor::displayMapEvents() {
DraggablePixmapItem *Editor::addMapEvent(Event *event) { DraggablePixmapItem *Editor::addMapEvent(Event *event) {
DraggablePixmapItem *object = new DraggablePixmapItem(event, this); DraggablePixmapItem *object = new DraggablePixmapItem(event, this);
if (event->get("event_type") != EventType::Object) { if (!event->usingSprite) {
object->setOpacity(0.7); object->setOpacity(0.7);
} }
events_group->addToGroup(object); events_group->addToGroup(object);

View file

@ -1616,6 +1616,7 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
object->spriteWidth = 16; object->spriteWidth = 16;
object->spriteHeight = 16; object->spriteHeight = 16;
object->usingSprite = false;
QString event_type = object->get("event_type"); QString event_type = object->get("event_type");
if (event_type == EventType::Object) { if (event_type == EventType::Object) {
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16); object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);