Create an online game written in JavaScript
5 September 2017
https://debs-obrien.github.io/JavaScript-Game-OpenClassRooms-Project-6/

function Avatar(active, notActive, attack, win, dead) {
this.active = active;
this.notActive = notActive;
this.attack = attack;
this.win = win;
this.dead = dead;
}
/*--------------------------------------------------------------------------------------------
Creates the weapons and players
--------------------------------------------------------------------------------------------*/
let game = new GameBoard(boardSize);
let blackBelt = new Weapon('BlackBelt', 70, 'blackBelt weapon', 'avatarWin');
let redBelt = new Weapon('RedBelt', 60, 'redBelt weapon');
let blueBelt = new Weapon('BlueBelt', 40, 'blueBelt weapon');
let greenBelt = new Weapon('GreenBelt', 30, 'greenBelt weapon');
let yellowBelt = new Weapon('YellowBelt', 20, 'yellowBelt weapon');
let whiteBelt = new Weapon('WhiteBelt', 10, 'whiteBelt weapon');
let combat1 = new Weapon('combat1', 40, 'combat1 weapon');
let combat2 = new Weapon('combat2', 20, 'combat2 weapon');
let combat3 = new Weapon('combat3', 30, 'combat3 weapon');
let combat4 = new Weapon('combat4', 30, 'combat3 weapon');
let scroll = new Weapon('scroll', 20, 'scroll weapon');
let player1 = new Player('Player 1', 100, 'player1', 1, 'whiteBelt', 10, 'avatar');
let player2 = new Player('Player 2', 100, 'player2', 2, 'whiteBelt', 10, 'avatar');
let player1Avatar = new Avatar('src/player1-active.png', 'src/player1-not-active.png', 'src/player1-attack.png', 'src/player1-win.png', 'src/player1-dead.png');
let player2Avatar = new Avatar('src/player2-active.png', 'src/player2-not-active.png', 'src/player2-attack.png', 'src/player2-win.png', 'src/player2-dead.png');
/*--------------------------------------------------------------------------------------------
Sets the player Data boxes
--------------------------------------------------------------------------------------------*/
function setPlayerData(playerDiv, player) {
$(playerDiv + ' .player-name').text(player.name);
$(playerDiv + ' .score').text(player.score);
$(playerDiv + ' .belt').addClass(player.weapon);
$(playerDiv + ' .weapon-value').text(player.damage);
$('#player-1-avatar').css('backgroundImage', 'url(' + player1Avatar.active + ')');
$('#player-2-avatar').css('backgroundImage', 'url(' + player2Avatar.notActive + ')');
}
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.