MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / start

Function start

examples/space_invaders/space_invaders.py:736–766  ·  view source on GitHub ↗

Start a new field of play.

(session, window, state, continue_=False)

Source from the content-addressed store, hash-verified

734
735
736def 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
769def main():

Callers 3

winFunction · 0.85
loseFunction · 0.85
mainFunction · 0.85

Calls 10

render_messageFunction · 0.85
promptFunction · 0.85
init_positionsFunction · 0.85
drawFunction · 0.85
oneMethod · 0.45
joinMethod · 0.45
queryMethod · 0.45
of_typeMethod · 0.45
updateMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected