In a tactics game, players take turns on a grid: you choose a unit, see the cells it can reach, move it, then it attacks. This guide builds the simplest game possible: one hero and one monster. Everything is already done in the Tactics tutorial example (Examples tab of the start screen): open its Blueprint, each step is in a colored frame with a small ? that explains it.
You need:
- a tile map of your choice (the game grid is the grid of this tile map);
- an Image named hero1 with the tag joueur, and another named foe1 with the tag ennemi;
- a Zone named terrain covering the whole map (it is the one you touch to choose a cell);
- a variable etat (integer, local) to know where we are: 0 = choose a hero, 1 = hero chosen, 2 = hero moved.
👉 Terrains (forest, sand, mountain…) are set in the tile editor, Terrains of the tiles part: step cost, blocked or not, defense bonus. The mountain blocks the way, the forest costs 2 steps.
Step 1: the unit sheets
- Add the “On Start” event.
- Add “Give a unit sheet” for hero1: health
20, attack6, defense2, movement4, range1. - Add a second “Give a unit sheet” for foe1, with its own numbers.
- Link the nodes in order, then add “Go to the next turn” with the teams
joueur,ennemi.
👉 The sheet is stored in the object: you can read it anywhere with a formula, for example
=hero1.vie.Step 2: the player's turn
- Add the “Local Event” event and write the name
tour_joueur. It starts by itself at the beginning of the player's turn. - Set etat to
0with “Modify Variable”, then “Hide the cells” to clear the old cells.
For each team, “Go to the next turn” runs the local event "tour_" followed by the team name: tour_joueur, then tour_ennemi.
Step 3: touch the hero, see the blue cells
- Add “On Object Click” on hero1.
- Add “If it is the turn of…” with the team
joueur, then on the True output a “Condition”etat < 2. - Add “Modify Variable”: etat =
1. - Add “Show reachable cells” on hero1: zone type Movement (walls count), number of steps
=hero1.mouvement, blue color, Write the step count on each cell = yes, These tags block the way =joueur,ennemi.
👉 The numbers on the cells are the steps needed to get there. Forest cells cost 2: the hero goes less far.
Step 4: touch a blue cell, the hero walks
- Add “On Object Click” on terrain, then a “Condition”
etat = 1. - Add “If the cell is reachable”. For the column and the row, touch 🔗 and choose the green nodes “Touched column” and “Touched row”: no formula to write.
- On the True output: “Modify Variable” etat =
4(the hero is walking), then “Go to the cell (path)” on hero1, with the same green nodes and These tags block the path =joueur,ennemi. - On the Arrived output, call the local event
apres_deplacementwith “Call event”.
Step 5: the attack zone, then the attack
- In the local event apres_deplacement: “Hide the cells”, etat =
2, then “Show reachable cells” with type Attack / range (goes over walls), number of steps=hero1.portee, red color, with the zone nameattaque. - Add “On Object Click” on foe1, a “Condition”
etat = 2and “If the cell is reachable” with the zone nameattaque. - On True: “Attack” (object A = hero1, object B = foe1). Damage is the attack, minus the monster's defense, minus its terrain's defense.
- Still alive output: update its health text. Out of health output: the monster is destroyed, add the victory.
Step 6: the monsters' turn
- Add the local event
tour_ennemi. - Add “Go to an object (path)” on foe1, object B = hero1, Stop = On a neighbor cell, centered, These tags block the path =
joueur,ennemi. - On the Arrived output, call a local event where foe1 “Attack” hero1.
- After a few seconds (“Wait”), “Stop the path” then “Go to the next turn”: the turn goes back to the player.
Going further
- Several heroes: add “Mark as having played” and “If the unit has already played” so a hero plays only once per turn (this is what the Tactics demo example does).
- A health bar: read
=hero1.vieand=hero1.vie_maxin a text or a progress bar. - Healing: “Heal” gives health back without going over the maximum.
- A board game: “Move the piece one cell” moves a piece one cell, well centered (◀ ▶ ▲ ▼ buttons).
If it does not work
- No blue cell: the hero must have the tag written in “If it is the turn of…”, and “Go to the next turn” must have been run at the start.
- The cells do not match the picture: the grid is the one of the first tile map of the scene. Without a tile map, cells are 80 px.
- The hero does not move: check that the touched cell is blue, and that etat is
1at that moment. - To compare, open the Tactics tutorial example: each part of the Blueprint is in a frame that explains it.