Start a new field of play.
(session, window, state, continue_=False)
| 734 | |
| 735 | |
| 736 | def start(session, window, state, continue_=False): |
| 737 | """Start a new field of play.""" |
| 738 | |
| 739 | render_message(session, window, "start_message", 15, 20) |
| 740 | prompt(window) |
| 741 | |
| 742 | init_positions(session) |
| 743 | |
| 744 | player = ( |
| 745 | session.query(GlyphCoordinate) |
| 746 | .join(GlyphCoordinate.glyph.of_type(PlayerGlyph)) |
| 747 | .one() |
| 748 | ) |
| 749 | state.update( |
| 750 | { |
| 751 | "field_pos": 0, |
| 752 | "alt": False, |
| 753 | "tick": 0, |
| 754 | "missile": None, |
| 755 | "saucer": None, |
| 756 | "player": player, |
| 757 | "army_direction": 0, |
| 758 | "flip": False, |
| 759 | } |
| 760 | ) |
| 761 | if not continue_: |
| 762 | state["score"] = 0 |
| 763 | |
| 764 | window.clear() |
| 765 | window.box() |
| 766 | draw(session, window, state) |
| 767 | |
| 768 | |
| 769 | def main(): |
no test coverage detected