display.level_view documentation - wladekpal/The-Lazy-Snek GitHub Wiki
LevelView
Class representing view of level displayed of screen.
Properties
- messages_font - font used to display win and loss messages on screen.
- frames_per_simulation_tick - number of frames displayed between each two ticks of level simulation.
- frames_till_next_tick - used as iterator to count number of frames to display before next tick of level simulation.
- level -
engine.level.Leveltype object which components are displayed on screen. - simulation -
gameplay.simulation.Simulationtype object that level simulation is managed by. - main_frame -
pygame.Surfacetype object, on wchich level should be displayed. - board_frame -
main_framesubsurface, on which level board should be displayed. - controls_frame -
main_framesubsurface, on wchich buttons controlling level simulation should be displayed. - buttons - list of
gameplay.button.Buttontype objects, that are buttons displayed oncontrols_frame, which are used to control level simulation.
LevelView(screen, level, frames_per_simulation_tick).
Set main_frame value to screen. Divides main_frame to parts described in level visualisation documentation and saves them in board_frame and controls_frame. Creates predefined buttons to be displayed on controls_frame. Sets level value to level argument value. Sets simulation value to new simulation with level given as an argument in constructor. Sets frames_per_simulation_tick value to value of argument with the same name and frames_till_next_tick to the same value.
refresh()
Refreshes level display. Requested when application displays next frame. Decrements frames_till_next_tick value. If it drops to zero, then resets it to initial value and from now on displays next level simulation tick.
handle_click()
Informs all buttons displayed that mouse button was clicked.
reset_simulation_ticks()
Resets frames_till_next_tick to its initial value. Should be used when restarting simulation, to avoid first simulation tick to be displayed for shorter time than other ticks.