MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / move_saucer

Function move_saucer

examples/space_invaders/space_invaders.py:664–682  ·  view source on GitHub ↗

Update the status of the saucer.

(session, window, state)

Source from the content-addressed store, hash-verified

662
663
664def move_saucer(session, window, state):
665 """Update the status of the saucer."""
666
667 saucer_interval = 500
668 saucer_speed_interval = 4
669 if state["saucer"] is None and state["tick"] % saucer_interval != 0:
670 return
671
672 if state["saucer"] is None:
673 state["saucer"] = saucer = GlyphCoordinate(
674 session, "saucer", -6, 1, score=random.randrange(100, 600, 100)
675 )
676 elif state["tick"] % saucer_speed_interval == 0:
677 saucer = state["saucer"]
678 saucer.blank(window)
679 saucer.x += 1
680 if saucer.right_edge_bound:
681 session.delete(saucer)
682 state["saucer"] = None
683
684
685def update_splat(session, window, state):

Callers 1

update_stateFunction · 0.85

Calls 3

blankMethod · 0.95
GlyphCoordinateClass · 0.85
deleteMethod · 0.45

Tested by

no test coverage detected