After some weeks of work, I ended in next design:
Hero class, that contains it HP, Damage, Speed, Range, Position in field coords (just Cell X and Cell Y) and sprite and has method for checking if sprite was clicked or not.
HeroCollection, which is shared between all game screens, and contains all heroes data.
Some pseudocode of game screen logic:
if (window.pollEvent()) {
Vector2f = Mouse.getMousePos();
if (wasUIUsed) //Check if menu, end turn button etc. were clicked {
doAction();
}
int cellX = transformRealX();
int cellY = transformRealY();
if (!clickInField) {
continue;
}
for (Hero hero : players heroes vectors) {
if (hero.isClicked() && hero.isEnemy()) {
hero.damage();
endTurn();
}
}
if (getCurrentHero()->canMoveTo(cellX, cellY)) {
getCurrentHero()->moveTo(cellX, cellY);
endTurn();
}
//draw everything
}
Is it OK?
Sorry, maybe question can be too broad.