July 2018
Intermediate to advanced
400 pages
12h 14m
English
Currently, the player’s status display is created by two calls to println. There is no variable that holds the value of the full display string.
The code looks like this:
// Player status
println("(Aura: $auraColor) " +
"(Blessed: ${if (isBlessed) "YES" else "NO" })")
println("$name $healthStatus")
And it produces output like this:
(Aura: GREEN) (Blessed: YES)
Madrigal has some minor wounds but is healing quite quickly!
For this more difficult challenge, make the status line configurable with a status format string.
Use the character B for blessed, A for aura color, H for healthStatus, and HP for healthPoints.
For example, a status format string of:
val statusFormatString = "(HP)(A) ...
Read now
Unlock full access