JSFiddle - React, Tailwind, and code Playground
by jasonwilczak
HTML
<div id="result"></div>
JavaScript
var resultDiv = document.getElementById("result");
function Engine() {};
Engine.prototype.play = function(_scene){
debugger;
resultDiv.innerHTML += _scene.description1;
resultDiv.innerHTML += "</br>";
resultDiv.innerHTML += _scene.description2;
resultDiv.innerHTML += "</br>";
resultDiv.innerHTML += _scene.option1;
resultDiv.innerHTML += "</br>";
resultDiv.innerHTML += _scene.option2;
resultDiv.innerHTML += "</br>";
var num = prompt("give a number 1 or 2");
resultDiv.innerHTML += num;
resultDiv.innerHTML += "</br>";
if (num === "1"){
if(_scene.nextScene1){
this.play(_scene.nextScene1);
}
else
{
resultDiv.innerHTML += "No scene 1";
}
} else if (num === "2"){
if(_scene.nextScene2){
this.play(_scene.nextScene2);
}
else
{
resultDiv.innerHTML += "No scene 2";
}
}
};
function someObject(myName,thing1Data,thing2Data,thing3Data) {
this.myName = myName;
this.thing1 = thing1Data;
this.thing2 = thing2Data;
this.thing3 = thing3Data;
}
var CrashScene = function(_description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2){
Setting.call(this, _description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2);};
var DesertScene = function(_description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2){
Setting.call(this, _description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2);};
var TeaScene = function(_description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2){
Setting.call(this, _description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2);};
var EatBigScene = function(_description1, _description2, _option1, _option2, _step, _nextScene1, _nextScene2){
Setting.call(this, _description1, _description2, _option1, _option2, _step, _nextScene1,...