Enemies and hits (Space Shooter)

Add enemies (V): SPAWN <tick <x puts one in the top row on that tick. Tick order: key, bullets move, spawns appear, then enemies step down one row every 3rd tick (ticks 3, 6, 9…). Then each bullet, oldest first, hits the first enemy (in order of appearance) in the same column at most one row away: both disappear, score +10 and print t=<tick hit at (<x,<y) score <score. Enemies leaving the bottom disappear. Finish with the field and player at <x, score <score.

Input: As before, plus SPAWN lines.

Output: Hit lines, the field and the summary.

Difficulty: Medium. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • “At most one row away” catches a bullet and an enemy that would otherwise swap places in one tick.

More Space Shooter practice