Skip to content

Commit f0d38bb

Browse files
committed
improved dialog
1 parent 13a6687 commit f0d38bb

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

html/asciiRPG.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,8 @@ var HUD = function(world, game){
763763
this.displayQueue = [];
764764
this.message = "";
765765

766-
this.addMessage("Ash: Whoa! Where am I?\n"+
767-
"Oak: You are in the wonderful world of Pokemon!!");
768-
this.prompt("Do you like it here?", function(resp){
769-
hud.addMessage("then " + resp);
770-
});
766+
this.addMessage("Welcome to the ASCII world of Pokemon!!");
767+
this.addMessage("Everything is drawn with letters, numbers, and symbols.");
771768

772769
this.isUp = false;
773770
this.menu = new HUDMenu([

html/sample_world.js

+29-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,35 @@ var sample_data = {
117117
},
118118
properties: {
119119
solid:true,
120-
description: "It's a lock.",
120+
inspect: function(actor){
121+
var hud = actor.world.hud;
122+
var keyOb_i = -1;
123+
var keyObj = null;
124+
for(var item_i=0;item_i< actor.bag.items.length;item_i++){
125+
if(actor.bag.items[item_i].name === "key"){
126+
keyOb_i = item_i;
127+
keyObj = actor.bag.items[item_i];
128+
}
129+
}
130+
hud.addMessage("It's a lock");
131+
if(keyOb_i >= 0){
132+
hud.prompt("Do you want to unlock it with your key?", function(resp){
133+
switch(resp){
134+
case "YES":
135+
keyObj.use(actor);
136+
137+
// remove single use items
138+
if(keyObj.singleUse === true)
139+
actor.bag.items.splice(keyOb_i, 1);
140+
break;
141+
case "NO":
142+
hud.addMessage("Ok, then");
143+
break;
144+
}
145+
});
146+
}
147+
return "";
148+
}
121149
},
122150
},
123151
water: {

0 commit comments

Comments
 (0)