From 6b8ff0b18fa286c3b5b38a675ea4faea0fe7e3ee Mon Sep 17 00:00:00 2001
From: Richard Halsall <richard-glyn.halsall@informatik.hs-fulda.e>
Date: Thu, 2 Feb 2023 19:37:22 +0100
Subject: [PATCH] Refactoring: Die Rolltaste ruft nun die Hauptspielschleife
auf, anstatt von der Hauptspielschleife aufgerufen zu werden
---
schlangen_und_leitern/HTML.html | 9 ++++---
schlangen_und_leitern/js/Bridge.js | 40 +++++++++++-------------------
2 files changed, 20 insertions(+), 29 deletions(-)
diff --git a/schlangen_und_leitern/HTML.html b/schlangen_und_leitern/HTML.html
index 165ded4..88d001f 100644
--- a/schlangen_und_leitern/HTML.html
+++ b/schlangen_und_leitern/HTML.html
@@ -8,6 +8,7 @@
+
Document
@@ -19,9 +20,9 @@
-
-
-
+
+
+
@@ -29,7 +30,7 @@
diff --git a/schlangen_und_leitern/js/Bridge.js b/schlangen_und_leitern/js/Bridge.js
index 52ecb5e..521115a 100644
--- a/schlangen_und_leitern/js/Bridge.js
+++ b/schlangen_und_leitern/js/Bridge.js
@@ -1,7 +1,7 @@
+let turnCount = 1;
-
-function mainGame(playerCount){
+function init(playerCount){
//playerselect versctecken
document.getElementById("2Player").style.display = "none";
document.getElementById("3Player").style.display = "none";
@@ -11,22 +11,17 @@ function mainGame(playerCount){
document.getElementById("würfelBereich").style.display = "grid";
// build/show board + get board array
- boarArr = buildBoard();
- drawBoard(boarArr);
-
-
- let playerArray = buildPlayerArray(playerCount);
+ boardArr = buildBoard();
+ drawBoard(boardArr);
- let rollresult = rollDice();
+ // make x "player" structures and add them to array
+ let playerArray = buildPlayerArray(playerCount);
- console.log("roll result =" + rollresult);
+ //miain game loop dictated by the pression of the dice roll button
+ document.getElementById("rollButton").addEventListener("click", function(){gameloop(boardArr,playerArray, playerCount);});
+
-
-
- // make x "player" structures and add them to array
-
-
//Haupt game loop
//select player
@@ -37,16 +32,11 @@ function mainGame(playerCount){
// victory condition
//if boardArr + roll => 99 player n wins
//new game
-
-
-
-
-
-
-
-
-
-
-
}
+
+function gameloop (boardArr, playerArray, playerCount){
+
+ let roll = rollDice();
+
+}
\ No newline at end of file