Example #1
0
    function click(e) {

        var position = utils.getPosition(e.stageX, e.stageY);

        var event = new createjs.Event('interface:mouse:click');
        event.data = position;
        this.dispatchEvent(event);
    }
Example #2
0
 var renderMovementPath = function (player, cursor, limit) {
     this._movementPath.removeAllChildren();
     var playerPosition = utils.getPosition(player.x, player.y);
     var start = [playerPosition.gridX, playerPosition.gridY];
     var cursorPosition = utils.getPosition(cursor.x, cursor.y);
     var end = [cursorPosition.gridX, cursorPosition.gridY];
     var teams = this.getStage().getChildAt(0)._teams;
     var occupiedTiles = utils.getGridsFromTeams(teams);
     var grid = utils.getPopulatedGrid(occupiedTiles);
     var path = utils.getMovementPath(grid, start, end);
     var range = (limit < path.length) ? limit + 1: path.length;
     for (var i = 0, j = range; i < j; i++) {
         var grid = path[i];
         var position = utils.getPositionFromGrid(grid[0], grid[1]);
         var colour = this.grid[position.gridX][position.gridY] ? 'rgba(255,0,0,0.5)' : null;
         this._movementPath.addChild(getTile(position.snapX, position.snapY, colour));
     }
 }
Example #3
0
    function mouseOver(e) {

        var position = utils.getPosition(e.stageX, e.stageY);

        console.log(position);

        var event = new createjs.Event('interface:mouse:move');
        event.data = position;
        this.dispatchEvent(event);
    }