void MainWindow::connectObjects() { QObject::connect(tilesetEditor, SIGNAL(statusTipUpdated(const QString &)), this, SLOT(updateStatusBar(const QString &)) ); QObject::connect(mapView, SIGNAL(mapChange()), this, SLOT(mapWasModified())); QObject::connect(mapView, SIGNAL(statusTipUpdated(const QString &)), this, SLOT(updateStatusBar(const QString &)) ); QObject::connect(tilesetEditor, SIGNAL(targetTileChange(int,int)), mapView, SLOT(targetTileChanged(int,int))); QObject::connect(entitySelector, SIGNAL(itemSelectionChanged()), this, SLOT(entityItemChanged())); QObject::connect(entitySelector, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(entityItemDoubleClicked(QTreeWidgetItem*,int))); QObject::connect(this, SIGNAL(entityListSelectionChange(int)), mapView, SLOT(entityListSelectionChanged(int))); QObject::connect(scriptSelector, SIGNAL(runScriptClicked(QString)), this, SLOT(runMapScript(QString))); }
void moveCharacter() { //PLAYER MOVEMENT // JUMP UP if (keyPressed[K_UP] && keyPressed[K_SPACE] && charLocation.Y > 0) { if (printMap[charLocation.Y - 2][charLocation.X] == 1){ } else{ charLocation.Y -= 2; } } // JUMP LEFT else if (keyPressed[K_LEFT] && keyPressed[K_SPACE] && charLocation.X > 0) { if (printMap[charLocation.Y][charLocation.X - 2] == 1){ } else{ charLocation.X -= 2; } } // JUMP DOWN else if (keyPressed[K_DOWN] && keyPressed[K_SPACE] && charLocation.Y < console.getConsoleSize().Y - 1) { if (printMap[charLocation.Y + 2][charLocation.X] == 1){ } else{ charLocation.Y += 2; } } // JUMP RIGHT else if (keyPressed[K_RIGHT] && keyPressed[K_SPACE] && charLocation.X < console.getConsoleSize().X - 1) { if (printMap[charLocation.Y][charLocation.X + 2] == 1){ } else{ charLocation.X += 2; } } //MOVE UP else if (keyPressed[K_UP] && charLocation.Y > 0) { if (printMap[charLocation.Y - 1][charLocation.X] == 1){ } else{ charLocation.Y -= 1; } } //MOVE LEFT else if (keyPressed[K_LEFT] && charLocation.X > 0) { if (printMap[charLocation.Y][charLocation.X -1] == 1){ } else{ charLocation.X -= 1; } } //MOVE DOWN else if (keyPressed[K_DOWN] && charLocation.Y < console.getConsoleSize().Y - 1) { if (printMap[charLocation.Y + 1][charLocation.X] == 1){ } else{ charLocation.Y += 1; } } //MOVE RIGHT else if (keyPressed[K_RIGHT] && charLocation.X < console.getConsoleSize().X - 1) { if (printMap[charLocation.Y][charLocation.X + 1] == 1){ } else{ charLocation.X += 1; } } mapChange(); // Change from one map to another refill(); // Refill items }