AB.restoreData ( function ( clicked ) { clicker(clicked); } );
function clicker(x) {
clicked = x;
}
function tbc() {
if (typeof clicked === 'undefined') {
clicked = [];
}
clicked.push('true');
console.log(clicked);
}
function move_on() {
AB.world.saveData = function () { return clicked; };
if (typeof clicked === 'undefined' || clicked.length<1) {
if (typeof clicked === 'undefined') {
clicked = [];
}
alert_box();
}
else {
dont_continue_lesson();
}
}
function alert_box() {
console.log('alert');
/*Creating and appending the element */
var element = '<div id="overlay" style="opacity:0"><div id="container">';
element += "<h1>Have you completed this lesson?</h1><p>It seems that you haven't completed all the tasks, are you sure you want to move on?</p></br></br>";
element += "<center><button onclick='dont_continue_lesson()' > Yes </button>";
element += "<button onclick='continue_lesson()'> No </button></center>";
element += "</div></div>";
document.body.innerHTML += (element);
document.getElementById('overlay').style.display = "block";
var fadeIn = setInterval(function () {
if (document.getElementById('overlay').style.opacity > 0.98) clearInterval(fadeIn);
var overlay = document.getElementById('overlay');
overlay.style.opacity = parseFloat(overlay.style.opacity, 10) + 0.05;
}, 50);
};
function continue_lesson() {
document.getElementById("overlay").outerHTML = "";
}
function dont_continue_lesson() {
AB.saveData ( clicked );
window.location.href = 'https://run.ancientbrain.com/run.php?world=7638012953';
console.log(clicked);
}
document.write ( `
<style id="css">
</style>
<header>
<img src="uploads/alexmurphy1996/if.png" align="left" height=23%/>
<h1> 6. If/Else Statements </h1>
</header>
<section>
<article>
<p>If/Else statements are one of the most important features of any programming languange. The idea is very simple - if(this is true) {do this}, else {do this}. That's all there is to it really. You can add in some else if() statements in the middle if you like, but the idea stays the same.</p>
</br></br><center><img src="uploads/alexmurphy1996/if_elsediagram.png"></center>
</br></br>
<h2>Exercise 6.1</h2>
<p>We use if/else statements as a way to do tasks if and when certain things are true. In this task you will be making a character do different things (run/jump/hide) depending on what is coming accross the screen.</p>
<center onclick="tbc()">` + AB.launchWorld ( "4383533311", "jump/duck/hide" ) + `</center>
</br>
<p>For this task you will write three if statements. They will be some for of if(runner=="cars","birds","thieves") {jump(), duck(), hide()}</p>
<p>You can figure out what action to do for each case.
</br></br></br>
<center><button class="btn success" onclick="move_on()">Let's Loop!</button><center>
</article>
<nav id='nav'> </nav>
</section>
` );
$.getScript("/uploads/alexmurphy1996/navigation.js", function()
{
$("#nav").html(thehtml);
});
$.getScript("/uploads/alexmurphy1996/css.js", function()
{
$("#css").html(the_css);
});