public/js-roguelike-skeleton/src/player.js
function Player(game) {
        this.game = game;
        this.fov = new RL.FovROT(game);

        // modify fov to set tiles as explored
        this.fov.setMapTileVisible = function(x, y, range, visibility){
            RL.FovROT.prototype.setMapTileVisible.call(this, x, y, range, visibility);
            if(visibility){
                var tile = this.game.map.get(x, y);
                if(tile){
                    tile.explored = true;
                }
            }
        };

        if(this.init){
            this.init(game);
        }
    }
function Player(game) {
        this.game = game;
        this.fov = new RL.FovROT(game);

        // modify fov to set tiles as explored
        this.fov.setMapTileVisible = function(x, y, range, visibility){
            RL.FovROT.prototype.setMapTileVisible.call(this, x, y, range, visibility);
            if(visibility){
                var tile = this.game.map.get(x, y);
                if(tile){
                    tile.explored = true;
                }
            }
        };

        if(this.init){
            this.init(game);
        }
    }
function Player ( game ) { this . game = game ; this . fov = new RL . FovROT ( game ) ; // modify fov to set tiles as explored this . fov . setMapTileVisible = function ( x , y , range , visibility ) { RL . FovROT . prototype . setMapTileVisible . call ( this , x , y , range , visibility ) ; if ( visibility ) { var tile = this . game . map . get ( x , y ) ; if ( tile ) { tile . explored = true ; } } } ; if ( this . init ) { this . init ( game ) ; } }
Represents the player.
Very similar to Entity
Handles functionality triggered by keyboard and mouse Input
@class Player
@constructor
@uses TileDraw
@param {Game} game - game instance this obj is attached to
Represents the player . Very similar to Entity Handles functionality triggered by keyboard and mouse Input