Skip to content

Commit

Permalink
forgot to port two examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ghuysmans committed Jul 19, 2021
1 parent df4c0f7 commit 15def09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions demos/zork_mini.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ <h1>Mini Zork</h1>
var io2=new IOKranf('container2');
var status="naked";

function *pageCourt()
async function pageCourt()
{
io.printhr();
new Audio("media/tetrisk_move.mp3").play();
io.printImage("media/zork_castle_court.jpg","300px");
io.println("\nYou are standing in the interior court of the castle.");
var x=yield io.click("Go to the Castle Gate","Enter the armory");
if (x=="Enter the armory") co(pageArmory());
var x=await io.click("Go to the Castle Gate","Enter the armory");
if (x=="Enter the armory") await pageArmory();
else if (x=="Go to the Castle Gate") pageGate();
}

function *pageArmory()
async function pageArmory()
{
new Audio("media/tetrisk_move.mp3").play();
io.printhr();
io.printImage("media/zork_castle_armory.jpg","300px");
io.println("\nYou are in the armory.There are plenty of weapons and a bottle.");
for(;;)
{
var x=yield io.click("Take a weapon","Drink the bottle","Go back in the court");
var x=await io.click("Take a weapon","Drink the bottle","Go back in the court");
if (x=="Take a weapon")
{
if (status=="naked")
Expand Down Expand Up @@ -70,7 +70,7 @@ <h1>Mini Zork</h1>
}
else if (x=="Go back in the court") break;
}
co(pageCourt());
await pageCourt();
}

function pageGate()
Expand All @@ -96,7 +96,7 @@ <h1>Mini Zork</h1>
io.autoScroll(true);
io.println("OBJECTIVE: You need to escape from the castle.\n");
io2.printImage("media/zork_inventory1.png","120px");
co(pageCourt());
pageCourt();
}
</script>
</body>
Expand Down
4 changes: 2 additions & 2 deletions hello_world.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ <h1>Learn Javascript</h1>
<script>
"use strict";
var io=new IOKranf('iokranf_container');
IOKranf_co(function*(){
(async function(){

io.println('Hello World!');


})</script>
})();</script>
</body>
</html>

0 comments on commit 15def09

Please sign in to comment.