Tag Archives: bsquaretx

Workflow: Using 2 Boards

In my RND I have come upon a method to use two Boards, one for use with movement logic, and the other for tile/sprite placement. The movement logic Board has more cells (x2 or x4) than the placement Board.

The movement Board is referred to as the MBoard, and the graphics Board is referred to as GBoard. Each Board has its own SquareTx object, MSquareTx and BSquareTx, respectively.

The SquareTx defines the physical dimensions of the Board, so each must be configured for its purpose. (MBoard/GBoard will be referred to inclusive of their SquareTx associations).

GBoard

The GBoard’s purpose to place tiles. The GBoard’s cell sizes are bigger in order to fit more unique looking graphics and cover more ground using tiles (instead of Tiled Image Objects).

The GBoard is essentially what is depicted in the Tiled editor.

MBoard

The MBoard is derivation of the GBoard. It’s constructed alongside the GBoard when it is read from the TMX.

The MBoard essentially subdivides the GBoard’s bigger tiles so that it would have 4x-8x more tiles, depending on the desired subdivision.

Setup

  • Create GBoard and MBoard
  • Create GSquareTx and MSquareTx. Associate with respective Boards.
  • Create SLG. Associate SLG with MBoard.
  • Create placement tile for MBoard. This can be any tile, but it must coverĀ one cell size of MBoard in order to register a click predictably.
  • SquareTx offsets tne cell widths are set, and Board width/height are set accordingly:

    Offset X is the same for both MBoard and GBoard. Offset Y is a little different to account for the half size of the MBoard cell. ‘-16’ is used in the image due to the 32×32 size of the MBoard cell.

Orthogonal functions

Some orthogonal-related functions must reflect the different coordinates.

In OXY2LXY (OrthoXY to LogicXY), the logical return value will obviously be different because of the different cell size.

All functions that use the SquareTx as a point of reference must have their own function for each board.

Debugging

It is best to use two different Text objects to debug the cells of the two Boards.

 

Advertisements