screens

screens

Game screens for AsteroidImpact

class screens.AsteroidImpactGameplayScreen(screen, screenstack, levellist, reaction_prompts_settings, game_element_opacity=255, **kwargs)

Bases: screens.GameScreen

Gameplay logic for the Asteroid Impact game.

advance_level()

Advance the current level to the next in the list

after_close(logrowdetails, reactionlogger, surveylogger)
draw()

draw game to self.screen

setup_level()

Setup for the current level

update_always(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)

Run per-frame game logic

update_notice_text(level_millis, oldlevel_millis)

Update level countdown text

update_status_text()

Update numbers in status text sprites

class screens.AsteroidImpactInfiniteGameplayScreen(screen, screenstack, level_templates_list, reaction_prompts_settings, game_element_opacity=255, game_globals=None, **kwargs)

Bases: screens.GameScreen

Gameplay logic for the Asteroid Impact game.

advance_level()

Advance the current level to the next in the list

after_close(logrowdetails, reactionlogger, surveylogger)
draw()

draw game to self.screen

setup_level(first=True, died_previously=False)

Setup for the current level

show_required_targets()
update_always(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)

Run per-frame game logic

update_notice_text(level_millis, oldlevel_millis)

Update level countdown text

update_status_text()

Update numbers in status text sprites

class screens.AsteroidImpactInfiniteLevelMaker(level_templates_list, start_level=0.0, level_completion_increment=1.0, level_death_decrement=1.0, continuous_asteroids_on_same_level=False, adaptive_asteroid_size_locked_to_initial=False, show_advance_countdown=False, multicolor_crystal_scoring=False, multicolor_crystal_numbers=[-1], **kwargs_ignored)

Bases: object

List-like class that generates new levels as they are requested

level_completed(level_millis, frame_outbound_triggers)

Increment level score based on level completion

level_death(level_millis, frame_outbound_triggers)

Reduce level score based on level failure

class screens.AsteroidImpactInstructionsScreen(screen, gamescreenstack, click_to_continue=True)

Bases: screens.GameScreen

Instructions Screen. Displays the game objects (ship, crystal, etc) and rules to the player.

draw()
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
class screens.BlackScreen(screen, gamescreenstack)

Bases: screens.GameScreen

Black screen. Shown to the player while other things are happening in other parts of the research. The player can’t interact with the black sceen.

draw()
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
class screens.GameOverOverlayScreen(screen, gamescreenstack)

Bases: screens.GameScreen

Show a “Game Over” message on top of the gameplay screen, pausing the gameplay while this screen is visible.

This screen automatically ends after a delay.

close()

Close this screen by removing it from the screen stack

draw()
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
class screens.GameScreen(screen, screenstack)

Bases: object

Base class for AsteroidImpact game screens

after_close(logrowdetails, reactionlogger, surveylogger)

Clean up after screen is closed, and perform additional logging

draw()

Draw the game screen to the physical screen buffer

update_always(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)

Update the screen’s game state every iteration regardless of if another screen is stacked on top

update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)

Update the screen’s game state when this screen is frontmost

class screens.LevelCompletedOverlayScreen(screen, gamescreenstack)

Bases: screens.GameScreen

Show a “Level Complete” message on top of the gameplay screen, pausing the gameplay while this screen is visible.

This screen automatically ends after a delay.

close()

Close this screen by removing it from the screen stack

draw()
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
class screens.ParallelPortTestScreen(screen, gamescreenstack, port_address=888)

Bases: screens.GameScreen

Parallel Port Test Screen. Display input pins status and toggle output pins by clicking on buttons.

draw()
next_button_clicked()
toggle_data_bit_for_button(button)
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
update_status_text()
exception screens.QuitGame(value)

Bases: exceptions.Exception

Exception to raise in update_xxx() to quit the game

class screens.SurveyButton(gamerect, text, onclick, option_index=-1)

Push button for “next” or toggle/radio button

draw(screen)
update(milliseconds)
class screens.SurveyQuestionScreen(screen, gamescreenstack, prompt='[No prompt value was specified]', survey_options=['[default choice]'], click_to_continue=True)

Bases: screens.GameScreen

Survey Question Screen. Prompt the player for the answer to a single multiple-choice question.

after_close(logrowdetails, reactionlogger, surveylogger)

Clean up after screen is closed, and perform additional logging

draw()
next_button_clicked()
option_button_click(button)
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
class screens.UserTextScreen(screen, gamescreenstack, click_to_continue=True, text='[No text value was specified]', title='')

Bases: screens.GameScreen

Text Screen. Displays text specified in step.

draw()
init_text(text, title)
update_frontmost(millis, logrowdetails, frame_outbound_triggers, events, step_trigger_count, reactionlogger)
screens.circularspritesoverlap(a, b)

Returns true if two circular game sprites overlap.

The sprite overlap is checked using their gamerect to find the sprite position and diameter.

screens.flow_text(text, bounds_rect, font, color, line_height, valign='middle')

Flow text into rectangle. Returns list of text elements and rectangle bounds of result.

screens.font_find_fitting_string_length(font, line, line_width_screenpx)

return the length (in characters) of the string that fits within lineWidth

screens.make_powerup(powerup_dict)

returns a new powerup of the type specified in the level JSON by checking the "type" key in powerup_dict.

screens.valid_breakpoint_character(c)

return true when c is a valid word-wrapping breakpoint character