engine.tunnel documentation - wladekpal/The-Lazy-Snek GitHub Wiki

engine.tunnel.Tunnel

Field subclass simulating tunnel where two snakes or convex blocks can overlap while heading in perpenticular directions.

Properties:

  • coordinates - coordinate pair holding tunnel location on board.
  • board - engine.board.Board object that tunnel is located on.
  • lower_field - engine.field.Field object that represents lower part of tunnel.
  • upper_field - engine.field.Field object that represents upper part of tunnel.
  • direction - engine.direction.Direction object that informs about direction in which/from which snake can enter upper part of tunnel.

Constructor

Takes direction. Constructor method, sets class attributes and loads texture.

set_coordinates(coordinates):

Method used to set coordinates attribute.

set_board(board)

Method used to set board attribute.

choose_field(direction):

Method used to determine based on direction which part of tunnel is being requested.

check_snake_move(snake)

Method that returns True if snake can enter the tunnel, False otherwise.

snake_entered(snake)

Method that simulates snake enterance.

snake_left()

Method has no effect.

remove_snake(snake)

Method used to remove snake from tunnel.

place_snake(snake)

Method used to place snake segment on field.

remove_flat()

Method has no effect.

place_flat(flat)

Method has no effect.

check_convex_move(direction)

Method that returns True if convex can enter the tunnel, False otherwise.

convex_entered(convex, direction)

Method that simulates convex enterance.

convex_left()

Method used to remove convex from tunnelafter it left by being moved.

remove_convex()

Method has no effect.

place_convex(convex)

Method has no effect.

self_draw(frame, draw_coords, side_length)

Method used to display field on screen. First, it draws field itself, then flat layer, then snake layer, finally convex layer, if those are present.

try_placing(block)

Method always returns false.

has_removable()

Method always returns false.

request_removable()

Method always returns None.