diff --git a/registration-system/view/signups/game1/index.php b/registration-system/view/signups/game1/index.php index 84edb49e3cd1116caabc9c3dac83f8f719cc063f..27af0bec90b7e21b018ee1a687c848dfe0db17c8 100644 --- a/registration-system/view/signups/game1/index.php +++ b/registration-system/view/signups/game1/index.php @@ -19,7 +19,7 @@ class Game1SignupMethod extends SignupMethod { } public function getJSDependencies() { - return ['../../js/jquery-1.11.1.min.js', 'jslib/d3.min.js', 'jslib/priority-queue.min.js', 'jslib/checkLineIntersection.js', + return ['../../js/jquery-1.11.1.min.js', '../../js/jquery-ui.min.js', 'jslib/d3.min.js', 'jslib/priority-queue.min.js', 'jslib/checkLineIntersection.js', 'js/events.js', 'js/achievements.js', 'js/svgUtils.js', 'js/pathFinder.js', 'js/vector.js', 'js/character.js', 'js/camera.js', 'js/environment.js', 'js/game.js']; } @@ -67,8 +67,12 @@ class Game1SignupMethod extends SignupMethod { <div id="game-game"> <div id="gameCanvas" style="overflow:hidden;position:relative"> <div id="gameRoot" style="position:relative"></div> + <div id="gameDialogue" class="bordered-box"></div> </div> </div> + + <div id="game-overlay"> + </div> </div> <script> diff --git a/registration-system/view/signups/game1/js/achievements.js b/registration-system/view/signups/game1/js/achievements.js index 9251f1d2534f6fdedc14b7b9319d44958eb77572..bcb047ae4250506093ef7ed750943f34da4ff3bf 100644 --- a/registration-system/view/signups/game1/js/achievements.js +++ b/registration-system/view/signups/game1/js/achievements.js @@ -11,6 +11,7 @@ function Achievements() { 'stroh': 'Warum liegt hier Stroh rum?', 'saw_devs1': 'Wilde Informatiker auf Wiese gesehen', 'moneyboy': 'Money Boy: Swag ist aufgedreht', + 'speedrun': 'Haalt stop! Denkt doch mal an die Kinder!!1!', 'woman': 'Mit einer Prinzessin gesprochen', 'plumber': 'Berufung: Gas, Wasser, Scheiße', 'princess': 'Prinzessin verärgert', diff --git a/registration-system/view/signups/game1/js/character.js b/registration-system/view/signups/game1/js/character.js index fb05a0e721d65741988c557c1ff54cd2132e5d25..96418a04e0a305aa9b0fa97adbada67fbe724cd3 100644 --- a/registration-system/view/signups/game1/js/character.js +++ b/registration-system/view/signups/game1/js/character.js @@ -141,6 +141,11 @@ Char.prototype.physics = function() { } stuckFixer += 0.5; + if (stuckFixer >= 4.0) { + this.setMoveTarget(this.translation[0], this.translation[1]); + return; + } + var nextPosition = (d < g_smallValue) ? this.moveTarget[0] : Vec.add(this.translation, v); } while (!this.pathFinder.canWalkOn(nextPosition[0], nextPosition[1])); diff --git a/registration-system/view/signups/game1/js/environment.js b/registration-system/view/signups/game1/js/environment.js index 38255cec8c49a7893dc270a6b837ab94a1e8b5bf..3e837adfa6a6bb6035192ea75d82e5cb7afc5732 100644 --- a/registration-system/view/signups/game1/js/environment.js +++ b/registration-system/view/signups/game1/js/environment.js @@ -23,10 +23,12 @@ Environment.progress = { landing_killedGoat: false, landing_dorfEntranceApproach: false, landing_ageChosen: false, + landing_enteredCastle: false, // dorf related dorf_talkedToWirt: false, dorf_pickedFood: false, + dorf_pickedFootAndLeftPub: false, dorf_boughtTicket: false, // ufer related @@ -63,7 +65,12 @@ Environment.mapEvents = { }, 'castle_entrance': { init: function(svg) { - + if (!Environment.progress.landing_enteredCastle) { + Game.log("Geh in die Fachschaft"); + Environment.progress.landing_enteredCastle = true; + } + if (Environment.progress.inventory_money) + d3.select('#moneybags').attr('opacity', 0); } }, 'castle_fs': { @@ -73,11 +80,13 @@ Environment.mapEvents = { }, 'dorf': { init: function(svg) { - if (!Environment.progress.dorf_pickedFood) + if (!Environment.progress.dorf_pickedFood) { Game.log("Geh ins Wirtshaus"); - if (!Environment.progress.dorf_boughtTicket && Environment.progress.dorf_pickedFood) { - Game.log("Rede mit der Prinzessin"); - } else { + } else if (!Environment.progress.dorf_pickedFootAndLeftPub && !Environment.progress.dorf_boughtTicket) { + Environment.progress.dorf_pickedFootAndLeftPub = true; + Game.log("Geh zum Reisebüro und rede mit der Prinzessin"); + } + if (!Environment.progress.dorf_pickedFood || Environment.progress.dorf_boughtTicket) { svg.select('#ticketfrau').style('display', 'none'); } } diff --git a/registration-system/view/signups/game1/js/events.js b/registration-system/view/signups/game1/js/events.js index 5f63127b788a1ac40bf19898613fc7a826a3caa6..5cfa8e25a7ba6bf90abaf31329dcd642d503b622 100644 --- a/registration-system/view/signups/game1/js/events.js +++ b/registration-system/view/signups/game1/js/events.js @@ -33,8 +33,7 @@ function EventHandler(svg) { } EventHandler.prototype.hasEventOn = function (trigger, x, y) { - return this.getEventOn(trigger, x, y, function () { - }); + return this.getEventOn(trigger, x, y, function () {}); }; EventHandler.prototype.getEventOn = function (trigger, x, y, callback) { @@ -44,6 +43,8 @@ EventHandler.prototype.getEventOn = function (trigger, x, y, callback) { for (var i = 0; i < this.eventNodes[trigger].length; ++i) { var node = this.eventNodes[trigger][i]; if (node.path.isInside(x, y)) { + if (node.action && !Story.actions[node.action].possible()) return; + hasEvent = true; if (trigger == 'walkon' && !this.walkOnEvents[node.id]) { this.walkOnEvents[node.id] = true; diff --git a/registration-system/view/signups/game1/js/story.js b/registration-system/view/signups/game1/js/story.js index 6b17b136aff7e5d6f909cc69899e43cdff1a264d..f46e144b54d241bb9453b6bedc0475186b41afad 100644 --- a/registration-system/view/signups/game1/js/story.js +++ b/registration-system/view/signups/game1/js/story.js @@ -7,6 +7,20 @@ Story.actions = { // ================================================================================================================= // Actions in the Fachschaft room + 'castlee_becomemoneyboy': { + possible: function() { + return Environment.progress.inventory_money !== true; + }, + action: function(event, context) { + if (context.bEnter === true) { + Game.achievements.triggerAchievement('moneyboy'); + if (Environment.progress.fs_firstApproach) + Game.log("Du hast das Geld. Hol dir die Rüstung in der Fachschaft ab."); + Environment.progress.inventory_money = true; + d3.select('#moneybags').attr('opacity', 0); + } + } + }, 'castlee_door': { state: { doorInitialPos: {} @@ -583,6 +597,25 @@ Story.actions = { kaese: Game.char.svg.select('#kaese'), griess: Game.char.svg.select('#griess') }; + var nodes = { + fleischBlast: Game.char.svg.select('#fleisch_blast'), + kaeseBlast: Game.char.svg.select('#kaese_blast'), + griessBlast: Game.char.svg.select('#griess_blast') + }; + + function appearanceBlast(blastElement, food) { + var cnt = 0; + var looper = setInterval(function () { + cnt++; + blastElement.style('display', (cnt % 2) ? 'block' : 'none'); + if (cnt > 10) { + clearInterval(looper); + food.style('display', 'block'); + blastElement.style('display', 'none'); + } + }, 60); + } + Story.dialogueHelper([{ bubble: '#wirt_speech', message: 'Na du!? Du bist wohl her gekommen um etwas zum Essen zu holen...' @@ -603,19 +636,19 @@ Story.actions = { bubble: '#wirt_speech', message: 'Prima! Ich habe dir ein Essen auf den Tisch gestellt.', action: function () { - food.fleisch.style('display', 'block'); + appearanceBlast(nodes.fleischBlast, food.fleisch); } }, { bubble: '#wirt_speech', message: 'Wenn du kein Fleisch ist, mache ich dir Käse und Brot.', action: function () { - food.kaese.style('display', 'block'); + appearanceBlast(nodes.kaeseBlast, food.kaese); } }, { bubble: '#wirt_speech', message: 'Aus der Sojamilch der Ziege habe ich Grießbrei gemacht.', action: function () { - food.griess.style('display', 'block'); + appearanceBlast(nodes.griessBlast, food.griess); } }], null, function () { Game.log('Wähle deinen Essenswunsch'); @@ -628,28 +661,71 @@ Story.actions = { return Environment.progress.dorf_talkedToWirt && !Environment.progress.dorf_pickedFood; }, action: function (event) { - Environment.progress.dorf_pickedFood = true; var food = { fleisch: Game.char.svg.select('#fleisch'), kaese: Game.char.svg.select('#kaese'), griess: Game.char.svg.select('#griess') }; if (event.id === 'click_fleisch') { - Environment.fapi.data.setValue('essen', 'ALLES'); - food.fleisch.style('display', 'none'); + Story.dialogueHelper([{ + answer: [{ + message: 'Ich esse alles!', + action: function () { + Game.log("Du isst also alles."); + Environment.progress.dorf_pickedFood = true; + Environment.fapi.data.setValue('essen', 'ALLES'); + food.fleisch.style('display', 'none'); + } + }, { + message: 'Fleisch mag ich nicht!', + action: function () { + } + }] + }], null, onPickDialogEnd); } else if (event.id === 'click_kaese') { - Environment.fapi.data.setValue('essen', 'VEGE'); - food.kaese.style('display', 'none'); + Story.dialogueHelper([{ + answer: [{ + message: 'Ich esse vegetarisch!', + action: function () { + Game.log("Du isst also vegetarisch."); + Environment.progress.dorf_pickedFood = true; + Environment.fapi.data.setValue('essen', 'VEGE'); + food.kaese.style('display', 'none'); + } + }, { + message: 'Neeee! Ich bin nicht auf Diät!', + action: function () { + } + }] + }], null, onPickDialogEnd); } else if (event.id === 'click_griess') { - Environment.fapi.data.setValue('essen', 'VEGA'); - food.griess.style('display', 'none'); + Story.dialogueHelper([{ + answer: [{ + message: 'Grieß schmeckt gut! Ich bringe mein eigenes Essen mit zur Fahrt!', + action: function () { + Game.log("Du bringst dein eigenes Essen mit."); + Environment.progress.dorf_pickedFood = true; + Environment.fapi.data.setValue('essen', 'VEGA'); + food.griess.style('display', 'none'); + } + }, { + message: 'Neee! Da werd ich doch nicht von satt!', + action: function () { + } + }] + }], null, onPickDialogEnd); + } + + function onPickDialogEnd() { + if (Environment.progress.dorf_pickedFood) { + setTimeout(function () { + food.fleisch.style('display', 'none'); + food.kaese.style('display', 'none'); + food.griess.style('display', 'none'); + }, 1000); + Game.log('Gehe zurück ins Dorf'); + } } - setTimeout(function () { - food.fleisch.style('display', 'none'); - food.kaese.style('display', 'none'); - food.griess.style('display', 'none'); - }, 1000); - Game.log('Gehe zurück ins Dorf') } }, diff --git a/registration-system/view/signups/game1/js/svgUtils.js b/registration-system/view/signups/game1/js/svgUtils.js index 3a04679b9ebbdc9fd058196c5c6b1e2b163b4ea2..ca3985874b57f35049b3c4fc1fd8d488a93b50fa 100644 --- a/registration-system/view/signups/game1/js/svgUtils.js +++ b/registration-system/view/signups/game1/js/svgUtils.js @@ -34,7 +34,7 @@ function Path(svgPathData, offset) { this.edges = []; if (!offset) offset = [0,0]; - var currentPosition = [offset[0], offset[1]]; + var currentPosition = [-offset[0], -offset[1]]; var lastPosition = null; var currentCommand = 'm'; diff --git a/registration-system/view/signups/game1/maps/castle_entrance.svg b/registration-system/view/signups/game1/maps/castle_entrance.svg index 1bbde223d4d04480e68aeb17de952a7109a76e43..8bb30204e1ddd7f5399227167519e2bc99372d80 100644 Binary files a/registration-system/view/signups/game1/maps/castle_entrance.svg and b/registration-system/view/signups/game1/maps/castle_entrance.svg differ diff --git a/registration-system/view/signups/game1/maps/dorf.svg b/registration-system/view/signups/game1/maps/dorf.svg index 83279be621e443a601e6d51ed607b8f07422cb6f..e1b6589d85144479295a5d407055cce034daf5b4 100644 Binary files a/registration-system/view/signups/game1/maps/dorf.svg and b/registration-system/view/signups/game1/maps/dorf.svg differ diff --git a/registration-system/view/signups/game1/maps/shop.svg b/registration-system/view/signups/game1/maps/shop.svg index 1e32083e6c3672ac52a0f62f8735ede94107e747..9dc74f32bb5599580d671bce80c370744b788ab5 100644 Binary files a/registration-system/view/signups/game1/maps/shop.svg and b/registration-system/view/signups/game1/maps/shop.svg differ diff --git a/registration-system/view/signups/game1/test.html b/registration-system/view/signups/game1/test.html index 95a6af09e497415de9218b24438800b57f99f4a7..7dcfedea3e409782efccb1f21673b14b20913968 100644 --- a/registration-system/view/signups/game1/test.html +++ b/registration-system/view/signups/game1/test.html @@ -4,6 +4,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link href="ui.css" rel="stylesheet"/> <script src="../../js/jquery-1.11.1.min.js" type="text/javascript"></script> + <script src="../../js/jquery-ui.min.js" type="text/javascript"></script> <script src="jslib/d3.min.js" type="text/javascript"></script> <script src="jslib/priority-queue.min.js" type="text/javascript"></script> <script src="jslib/checkLineIntersection.js" type="text/javascript"></script> @@ -57,6 +58,8 @@ <div id="gameDialogue" class="bordered-box"></div> </div> </div> + <div id="game-overlay"> + </div> </div> <script> g_smallValue = 0.000001; // fun with floats diff --git a/registration-system/view/signups/game1/ui.css b/registration-system/view/signups/game1/ui.css index f19b3762e2465c8336e99eec74358cecdf60f144..4991d16caff31f01c0932353c5a7b663f01ea896 100644 --- a/registration-system/view/signups/game1/ui.css +++ b/registration-system/view/signups/game1/ui.css @@ -24,6 +24,16 @@ width: 189px; } +#game-overlay { + position: absolute; + top: 0; + left: 0; + width: 800px; + height: 600px; + display: none; + background-color: #000; +} + .bordered-box { font-family: ‘Lucida Console’, Monaco, monospace; color: white; @@ -54,6 +64,7 @@ } #gameDialogue ul li:hover { background-color: #474c46; + cursor: pointer; } #gameDialogue ul li:before { content: '⇢';