Compare commits
No commits in common. "feature/shogun-in-danger" and "master" have entirely different histories.
feature/sh
...
master
@ -36,8 +36,6 @@ class Game {
|
|||||||
this.blackPlayer = new Player('black');
|
this.blackPlayer = new Player('black');
|
||||||
this.chosenFigure = new Figure(0,0);
|
this.chosenFigure = new Figure(0,0);
|
||||||
this.fields = [];
|
this.fields = [];
|
||||||
this.currentPlayer = 'white';
|
|
||||||
this.otherPlayer = (this.currentPlayer == 'white') ? 'black' : 'white';
|
|
||||||
}
|
}
|
||||||
drawGamePanel(x,y, widthAndHeight) {
|
drawGamePanel(x,y, widthAndHeight) {
|
||||||
var boxes = new Array();
|
var boxes = new Array();
|
||||||
@ -95,10 +93,6 @@ class Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleClick(item) {
|
handleClick(item) {
|
||||||
if(!item.classList.contains(this.currentPlayer) && !item.classList.contains('possibleMove')) {
|
|
||||||
alert(this.otherPlayer + ' ist nicht dran');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(item.classList.contains('shogun') || item.classList.contains('farmer')) {
|
if(item.classList.contains('shogun') || item.classList.contains('farmer')) {
|
||||||
this.chosenFigure.setX(item.getAttribute('data-x'));
|
this.chosenFigure.setX(item.getAttribute('data-x'));
|
||||||
this.chosenFigure.setY(item.getAttribute('data-y'));
|
this.chosenFigure.setY(item.getAttribute('data-y'));
|
||||||
@ -359,13 +353,6 @@ class Game {
|
|||||||
this.showPossibleMoves();
|
this.showPossibleMoves();
|
||||||
this.chosenFigure.reset();
|
this.chosenFigure.reset();
|
||||||
game.updateLists();
|
game.updateLists();
|
||||||
this.switchPlayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
switchPlayers() {
|
|
||||||
var currentPlayer = this.currentPlayer;
|
|
||||||
this.currentPlayer = this.otherPlayer;
|
|
||||||
this.otherPlayer = currentPlayer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removeIndicator() {
|
removeIndicator() {
|
||||||
@ -377,6 +364,8 @@ class Game {
|
|||||||
updateLists() {
|
updateLists() {
|
||||||
var whiteList = document.querySelector('.whitePlayer');
|
var whiteList = document.querySelector('.whitePlayer');
|
||||||
var blackList = document.querySelector('.blackPlayer');
|
var blackList = document.querySelector('.blackPlayer');
|
||||||
|
console.log(whiteList)
|
||||||
|
console.log(blackList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user