SET myStrength TO 10
SET cpuStrength TO 5
SET myHealth TO 50
SET cpuHealth TO 30
WHILE myHealth < 1 OR cpuHealth < 1
SET temp TO RANDOM INT BETWEEN 1 AND myStrength
OUTPUT temp AS "My attack strength"
DECREASE cpuHealth BY temp ("My attack strength")
SET temp TO RANDOM INT BETWEEN 1 AND cpuStrength
OUTPUT temp AS "CPU attack strength"
DECREASE myHealth BY temp ("CPU attack strength")
Attach the code to a moving character, that initiates turn based combat upon proximity sensor. Improve sprite costumes and background.
2. Health bar
Draw a health bar sprite with 5 costumes, each representing 10 units of health, depleting from costume 1 to 5, and changing colour from green to red (as my health diminishes).
As my health decreases from 50 (full) in-game, each time the health decreases below 40, 30, 20 and 10 respectively, change the costume to show an indication of the appropriate health remaining.
3. Second attacker
Once the first character is defeated, spawn a second attacker. My health should carry over from the first round of combat (if you have taken any damage), but (obviously) the second attacker should be spawned with full health. The second attacker should be equal in strength to the first attacker. Once you defeat the second attacker, the game should finish.
4. Variable attackers
Use random ranges to spawn attackers with different strengths and healths. Play-test and balance as appropriate.
5. More elements
Other elements you could consider adding:
health powerups chance
cast spells / 'magic meter'
items or pickups that can be used to boost attributes
animations - such as dice rolling to represent random number generation on screen (à la Dungeons and Dragons)