Class cocos.grid.TiledGrid3D

GridBase --+
           |
          TiledGrid3D

TiledGrid3D is a 3D grid implementation. It differs from Grid3D in that the tiles can be separated from the grid.

The vertex array will be built with:

self.vertex_list.vertices: x,y,z (floats)
self.vertex_list.tex_coords: x,y (floats)
self.vertex_list.colors: RGBA, with values from 0 - 255

Methods

  set_tile(self, x, y, coords)
Set the 4 tile coordinates
[ float, float, float, float, float, float, float, float, float, float, float, float ] get_original_tile(self, x, y)
Get the 4-original tile coordinates.
[ float, float, float, float, float, float, float, float, float, float, float, float ] get_tile(self, x, y)
Get the current tile coordinates.
  __init__(self) (Inherited from cocos.grid.GridBase)
  after_draw(self, camera)
Called by CocosNode when the texture is already grabbed.
(Inherited from cocos.grid.GridBase)
  before_draw(self)
Binds the framebuffer to a texture and set a 2d projection before binding to prevent calculating a new texture
(Inherited from cocos.grid.GridBase)
  init(self, grid)
Initializes the grid creating both a vertex_list for an independent-tiled grid and creating also a vertex_list_indexed for a "united" (non independent tile) grid.
(Inherited from cocos.grid.GridBase)

Properties

  active
Determines whether the grid is active or not :type: bool
(Inherited from cocos.grid.GridBase)

Instance Variables

  vertex_list
vertex array that can be transformed.
  vertex_points
original vertex array of the grid.
  grid
size of the grid.
(Inherited from cocos.grid.GridBase)
  x_step
x pixels between each vertex (float)
(Inherited from cocos.grid.GridBase)
  y_step
y pixels between each vertex (float)
(Inherited from cocos.grid.GridBase)

Class Variables

  texture = None (Inherited from cocos.grid.GridBase)

Method Details

set_tile

set_tile(self, x, y, coords)

Set the 4 tile coordinates

Coordinates positions:

3 <-- 2
      ^
      |
0 --> 1
Parameters:
x : int
x coodinate of the tile
y : int
y coordinate of the tile
coords : [ float, float, float, float, float, float, float, float, float, float, float, float ]
The 4 coordinates in the format (x0, y0, z0, x1, y1, z1,..., x3, y3, z3)

get_original_tile

get_original_tile(self, x, y)

Get the 4-original tile coordinates.

Coordinates positions:

3 <-- 2
      ^
      |
0 --> 1
Parameters:
x : int
x coordinate of the tile
y : int
y coordinate of the tile
Returns:
[ float, float, float, float, float, float, float, float, float, float, float, float ]: The 4 coordinates with the following order: x0, y0, z0, x1, y1, z1,...,x3, y3, z3

get_tile

get_tile(self, x, y)

Get the current tile coordinates.

Coordinates positions:

3 <-- 2
      ^
      |
0 --> 1
Parameters:
x : int
x coordinate of the tile
y : int
y coordinate of the tile
Returns:
[ float, float, float, float, float, float, float, float, float, float, float, float ]: The 4 coordinates with the following order: x0, y0, z0, x1, y1, z1,...,x3, y3, z3

Instance Variable Details

vertex_list

vertex array that can be transformed. it has these attributes:

  • vertices
  • colors
  • tex_coords

for more information refer to pyglet's documentation: pyglet.graphics.vertex_list

vertex_points

original vertex array of the grid. (read-only)