Skip to content

Game Structure

oliverlevy110 edited this page Jan 17, 2020 · 4 revisions

Nodes within the Main Scene

3D Environment

  • Background: The sprite that contains the background image.
  • Directional Light:
  • Camera: The viewport the player looks out from.

Game Board

  • Matrix (MeshInstance)(Children: Gridmap, Position3D, DropTrail): This is the game board. It contains a GridMap.
    • Position3D: origin of falling pieces.
  • Hold (MeshInstance): A

UI Controls

  • Scene to hold pause text. Can change UI controls in this scene.
  • The available keyboard-controls are coded in res://controls.gd

Documentation on Nodes:

  • MeshInstance: MeshInstance is a node that takes a Mesh resource and adds it to the current scenario by creating an instance of it. This is the class most often used to get 3D geometry rendered and can be used to instance a single Mesh in many places.

Pieces

  • Game pieces are held in J/I/O/L/N/T/S/Z .tscn file. Game blocks are rectangular meshes. Color is set by emission color (in properties).
  • Structure of a piece: Each piece is made of four instanced Minos. Mino is a scene in itself. Mino has the scene Minomesh, which controls all of the visual properties of the blocks. Piece(L)->Mino->MinoMesh.
  • The primary code containing all the methods that can be called on a piece are contained in __Tetromino.gd

Script Structure

  • Main:
  • GridMap (Board):
  • Tetrominos: Contains all the functions to manipulate a piece. Called in GridMap and Main.
  • Tetro(I/J/N/O/S/T/Z): Contains rotating instructions to override the instructions in Tetrominos.