I hope my question isn't always the same question. I have a QGraphicsScene. Its items are some QGraphicsPixmaps. I move them with a timer that every second does SetX +10. I set +10 cause the window is large 100. With this solution my animations aren't smooth. I thought I could make them smoother by setting instead of +10 a +1...+10. But it didn't work.
Can you suggest me a way to do that please? Thanks a lot.
void GameGui::updateScene()
{
for (int y = 0; y < game->getHeight(); ++y) {
for (int x = 0; x < game->getWidth(); ++x) {
Actor* a = game->get(y, x);
if (sceneItems[a] != 0) {
sceneItems[a]->setX(x*SIZE);
sceneItems[a]->setY(y*SIZE);
}
}
}
}
Each actor is my game character (in his functions, such as moving ecc) in my core part of the progamm. sceneItems is a map where I associate each actor to his pixmap. x, y are the positions in the abstract scene and x*SIZE is the position in the graphicscene. The positions are updating in the abstract scene and i represent them in the graphicscene.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)