Docs Tutorials
Take apart: Hexbound
Play a card battler, then see how three lists of text make a whole run, and how a short script listens to it.
In the editor: Welcome ▸ Tutorials ▸ 4.2 ▸ ▶ Start opens a fresh copy of Hexbound with this lesson's checklist.
Take apart · about 35 minutes · Advanced mode
What you'll learn: how a turn-based card game is put together: cards, foes and fights as lines of data, a run the engine plays for you, and a world script that reacts to the run's events.
Before you start: do Take apart: Voxel Rally.
#1. Play it first
Open Hexbound from the sample games on the welcome window's Start tab (or File ▸ New Project… and pick it) and press F5. Pick a path on the run map. In a fight, play cards with your energy, watch what each foe means to do next (its intent over its head), and end your turn. Win a fight and pick a new card. Find a rest fire and a shop before you stop.
#2. Read the notes
Stop with Shift+F5 and switch to Advanced with Basic | Advanced on the toolbar, so the Explorer, the Scripts tab and the Cards page show. Open Explorer ▸ Notes. The welcome note says it plainly: the whole run is the engine's Cards system. The sample only adds the data, four rooms and a short script.
#3. The game is in Game Settings
Open Game Settings ▸ Cards. Card run is on, and the numbers are here: Starter deck, Energy each turn, Cards drawn each turn, Starting gold, Floors on the run map, Rest fire heal and Card removal cost.
Under them are three lists, one line each:
- The cards: name, cost, kind, rarity, effects, upgraded effects and picture. Hex bolt is
Hex bolt | 1 | attack | starter | damage 6 | damage 9 | Card Hex bolt. The picture is optional. - The foes: name, health, model, moves, phase 2 moves, size and the phase 2 line. Orrin Vex gets his second move list at half health.
- The fights: kind, foes, place and floors. The run picks fights from here by kind and floor.
This is the pattern: the rules live in the engine, and your game is the data. A line with a mistake is reported under the list and left out, so read the box after every edit.
#4. Where fights happen
Open the The Hexbound Spire level. It's four rooms in a row: Library, Workshop, Observatory and Crown. Each has a Rune circle whose Script name is its room's name. A fight line's place must match that name exactly, and the fight is staged on that circle.
#5. The state in code
Open The tower (main control) in the Scripts tab. It doesn't run the fights. It only listens: on("room", …) shows a popup when you pick an elite, the boss or a late rest (it checks run_floor()), and on("battle_won", …) pays 25 gold after an elite with give_gold().
#6. Change it
- Set Energy each turn to 4 and feel how much easier the first fights are.
- In The foes, lower Orrin Vex's health from 150.
- Add a card to The cards:
Spark jab | 1 | attack | common | damage 7 | damage 10. - In the tower script, add a small reward after every normal fight:
on("battle_won", function(kind)
if kind == "fight" then
give_gold(5)
popup("5 gold for a clean win.")
end
end)
Play it now: win a fight, see the 5 gold, and look for Spark jab among the rewards.
#Try it yourself
- Move the first fights to the Workshop by changing their place in The fights.
- Write a card that costs 0 and adds Block, and make its upgraded version better.
- Use
on("card_played", …)to say something the first time you play Hex bolt.
#Learn more
- Card battles:
battle(),deck(),give_gold()and the run's events. - Game settings.
#Next
Get an email when Voxel Game Maker launches
It's coming to Steam with a launch discount. One email on launch day, the odd progress update, nothing else.