Actions

Difference between revisions of "Gameboard"

From Future Skill

Line 9: Line 9:
  
 
== GameBoard quick setup ==
 
== GameBoard quick setup ==
 +
Here's an example to quickly get up and running:
 
<div style="background: #F0F0F0>
 
<div style="background: #F0F0F0>
 
  <nowiki>
 
  <nowiki>
Line 14: Line 15:
 
from gameboard_helpers import CommonSetups, Style
 
from gameboard_helpers import CommonSetups, Style
  
fn init():
+
class Challenge:
  board = GameBoard()
+
  fn __init__(self, context):
  CommonSetups.square(board)
+
    board = GameBoard()
  Style.topdown(board)
+
    CommonSetups.square(board)
  board.fill(10, 10)
+
    Style.topdown(board, context.canvas)
 +
    board.fill(10, 10)
 
</nowiki>
 
</nowiki>
 
</div>
 
</div>
 +
 +
The CommonSetups class configures the board to use a square tiled grid with four directions.
 +
The Styles class then configures how the board is displayed, with what tiles and how they are laid out.

Revision as of 10:45, 8 April 2021

[DRAFT] The GameBoard library

A reusable and configurable system for game-like challenges.

[TODO]

  • Board quick setup
  • Creating and placing a gamepiece
  • Pathfinding
  • Custom board setup

GameBoard quick setup

Here's an example to quickly get up and running:

from gameboard import GameBoard
from gameboard_helpers import CommonSetups, Style

class Challenge:
  fn __init__(self, context):
    board = GameBoard()
    CommonSetups.square(board)
    Style.topdown(board, context.canvas)
    board.fill(10, 10)

The CommonSetups class configures the board to use a square tiled grid with four directions. The Styles class then configures how the board is displayed, with what tiles and how they are laid out.