Back to Set 2

Code Challenge: Dodge

Difficulty  

divider

The Brief

What they asked for
Something crosses the screen and I have to not be hit by it.
When it gets me, the round is over and I can see how long I
lasted.

Write your requirements list before you write any code. What the player does, what happens on screen, and every question the brief did not answer.


Notes

  • The hardest one in this set. Do not start it unless Paddle and Catch already works.
  • The obstacle needs to come back after it leaves. That is a decision about position, not a bounce.
  • The round is over means the program is in a different state — a variable that says so, and a love.draw that checks it.
  • A survival time is a variable with dt added to it, which stops being added to when the round ends.
  • The brief does not say whether you can restart. If you add it, say so; if you do not, say that too.

What Success Looks Like

  • The player moves and stays inside the window
  • The obstacle keeps coming, without you pressing anything
  • A hit ends the round immediately, once
  • The time survived is shown and is correct

Sit still and let it hit you. Then dodge for thirty seconds. Both should end the same way, with a sensible number.


Submit

Your requirements list and your program folder, named cc-dodge.

Commence Challenge