Description

Test cell lines which coincide with the lines of the polygons of the entity

[
    [
        {
            points: {
                x: 5, y: 5
            },
            sides: 2
        }
    ],

]

sides sends lines of polygons of the entity which coincide with the grid lines. 0 corresponds to the first line from the first point of the polygon. The number of lines is equal to the order (n) of the polygon - 1.

Usage

Parameters

  • cell {Object}

    The cell defined by the object {col: Integer, row: Integer}

  • entity {Entity|EntityModel}

Returns

Array

Example

In ready method

var entity = Class.New("Entity", [stage]), pos;
entity.rect(10);
pos = entity.position();

var grid = Class.New("Grid", [2, 2]);

grid.setCellSize(32, 32);

grid.testCell({
    col: 0,
    row: 0
}, entity)

// => returns 
/*
[
    [
        {
            points: {
                x: 0, y: 0
            },
            sides: 0
        }
    ],
    [],
    [],
    [   
        {
            points: {
                x: 0, y: 0
            },
            sides: 3
        }
    ]
]

Discussion