var CANVAS_WIDTH = 790;
var CANVAS_HEIGHT = 960;

var CANVAS_WIDTH_HALF = CANVAS_WIDTH * 0.5;
var CANVAS_HEIGHT_HALF = CANVAS_HEIGHT * 0.5;

var FONT = "pixel_lcd7regular";
var FONT2 = "arialbold";

var EDGEBOARD_X = 150;
var EDGEBOARD_Y = 0;

var FPS = 30;

var FPS_TIME = 1 / FPS;

var ROLL_BALL_RATE = 60 / FPS;

var DISABLE_SOUND_MOBILE = false;

var STATE_LOADING = 0;
var STATE_MENU = 1;
var STATE_HELP = 1;
var STATE_GAME = 3;

var BATTER_MODE = 0;
var BOWLER_MODE = 1;

var TOT_TEAMS = 6;

var POINT_TEXT_EXCELLENT;

var POINT_TEXT_GREAT = 85;

var TEXT_EXCELLENT_COLOR = ["#fff", "#5d96fe"];

var PLAYER_SELECTION_FLAG_START_POS = {x: CANVAS_WIDTH_HALF - 180, y: CANVAS_HEIGHT_HALF - 85};

var OPPONENT_SELECTION_FLAG_START_POS = {x: CANVAS_WIDTH_HALF + 72, y: CANVAS_HEIGHT_HALF - 85};

var MAX_COL_FLAG = 2;

var FLAG_OFFSET = {x: 110, y: 75};

var TRAJECTORY_Y_BALL_CAUGHT = -250;

var BATTER_X = (CANVAS_WIDTH / 2) - 140;
var BATTER_Y = CANVAS_HEIGHT - 620;

var BOWLER_X = (CANVAS_WIDTH / 2) - 50;
var BOWLER_Y = (CANVAS_HEIGHT / 2) - 475;

var BALL_X = BOWLER_X + 86;
var BALL_Y = BOWLER_Y + 50;

var BALL_TO_THROW;
var STEP_SPEED_BALL;
var BEAT_FORCE = 0.5;
var STEP_SPEED_STADIUM;

var TARGET_PREV_LUM_OFFSET = {min: -12, max: -5};

var LAUNCH_DIR_OFFSET_RANGE = [{min: -90, max: -50}, {min: -5, max: 5}, {min: 50, max: 90}];//LEFT CENTER RIGHT

var POLE_POSITION = {x: CANVAS_WIDTH_HALF, y: CANVAS_HEIGHT - 200};

var OFFSET_FOR_HIT;
var OFFSET_FOR_PERFECT_HIT;
var PERFECT_HIT_X = BALL_X - 36;
var PERFECT_HIT_Y = CANVAS_HEIGHT - 410;
var ALMOST_MINUS;
var ALMOST_PLUS;
//WHEN BALL IS THROWN
var END_POINT_X_THROWN = PERFECT_HIT_X;
var END_POINT_Y_THROWN = PERFECT_HIT_Y;
//WHEN BALL IS MISSED
var END_POINT_X_MISSED_BALL = POLE_POSITION.x;
var END_POINT_Y_MISSED_BALL = POLE_POSITION.y;
//WHEN BALL IS HITTED
var END_POINT_X_ALMOST_MINUS_LEFT = (CANVAS_WIDTH / 2) - 200;
var END_POINT_X_ALMOST_MINUS_RIGHT = (CANVAS_WIDTH / 2) + 200;
var END_POINT_Y_ALMOST_MINUS = 50;
var END_POINT_X_ALMOST_PLUS_LEFT = (CANVAS_WIDTH / 2) - 300;
var END_POINT_X_ALMOST_PLUS_RIGHT = (CANVAS_WIDTH / 2) + 300;
var END_POINT_Y_ALMOST_PLUS = 50;
var END_POINT_X_PERFECT_LEFT = (CANVAS_WIDTH / 2) - 100;
var END_POINT_X_PERFECT_RIGHT = (CANVAS_WIDTH / 2) + 100;
var END_POINT_Y_PERFECT = 0;

var MAX_FRAMES_THROWN = 40;

var START_POINT_STADIUM_X = (CANVAS_WIDTH / 2);
var START_POINT_STADIUM_Y = (CANVAS_HEIGHT / 2) + 250;
var NUM_SPRITE_PLAYERS = 40;
var NUM_SPRITE_BATTING = 36;
var NUM_SPRITE_BOWLER = 56;
var NUM_SPRITE_BATTER_BOWLER_MODE = 81;

var STEP_RATE = 1.5;

var PHYSICS_ACCURACY = 3;

var MOBILE_OFFSET_GLOVES_X = -45;
var MOBILE_OFFSET_GLOVES_Y = -38;

var BALL_VELOCITY_MULTIPLIER = 1;

var PHYSICS_STEP = 1 / (FPS);

var BALL_MASS = 0.16;//0.160

var BALL_RADIUS = 0.6;

var BALL_LINEAR_DAMPING = 0.2;

var OFFSET_BALL_POS_X = 10;

var OBJECT;

var TEXT_SIZE = [50, 65, 80];

var TIME_TRY_TO_SHOT_BALL_OPPONENT = 0.7;

var MIN_BALL_VEL_ROTATION = 0.1;

var TIME_RESET_AFTER_GOAL = 1;

var TIME_RESET_AFTER_KEEPER_SAVED = 2;

var TIME_RESET_AFTER_PERFECT_KEEPER_SAVED = 3;

var TIME_BALL_IN_HAND = 1000;

var FOV = 35;

var INTERVAL_SHOOT = 1;

var HAND_KEEPER_ANGLE_RATE = 0.15;

var LIMIT_HAND_RANGE_POS = {x: 8.8, zMax: 5.1, zMin: -8.5};

var POSITION_BALL = {x: 60, y: 220, z: 0};

var LINE_GOAL_SIZE = {width: 17.5, depth: 1, height: 15.5};

var GOAL_LINE_POS = {x: 0, y: 10, z: -2.7};

var GLOVE_SIZE = {width: 1.4, depth: 1, height: 1.7};

var LEFT_GLOVE_POSITION = {x: -1.5, y: 40, z: 0};
var RIGHT_GLOVE_POSITION = {x: 1.5, y: 40, z: 0};

var LAUNCH_BALL_IMPULSE = {x: -4.47, y: 0, z: 1};

var LEFT_GLOVE = 0;
var RIGHT_GLOVE = 1;

var GLOVE_REG = [{x: 3, y: -5}, {x: -3, y: -5}];

var SHOW_3D_RENDER = false;

var CAMERA_TEST = false;

var MOUSE_SENSIBILTY = 0.03;

var OFFSET_MOUSE_X = -75;

var SCORE_ERROR_MULTIPLIER = 20;

var INTENSITY_DISPLAY_SHOCK = [{x: 30, y: 20, time: 75}, {x: 50, y: 25, time: 75}, {x: 70, y: 30, time: 75}, {x: 90, y: 40, time: 75}];

var CAMERA_POSITION = {x: 0, y: 0, z: 100};
var NEAR = 10, FAR = 2000;

var STATE_INIT = 0;
var STATE_PLAY = 1;
var STATE_FINISH = 2;
var STATE_PAUSE = 3;

var ON_MOUSE_DOWN = 0;
var ON_MOUSE_UP = 1;
var ON_MOUSE_OVER = 2;
var ON_MOUSE_OUT = 3;
var ON_DRAG_START = 4;
var ON_DRAG_END = 5;

var HIT_LEFT = 0;
var HIT_CENTER = 1;
var HIT_RIGHT = 2;

var ENABLE_FULLSCREEN;
var ENABLE_CHECK_ORIENTATION;