summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2014-11-03 16:32:17 +0100
committerGubolin <gubolin@fantasymail.de>2014-11-03 16:32:17 +0100
commit1f750eb56047320f5c835c8b997f75e5e513d4eb (patch)
treea7ebc72198e802ac31e8fccc781a5ab26c28dbe2
parent5f3279990be3478fde79b94f7dbd5d7da80df84b (diff)
downloadsnap-1f750eb56047320f5c835c8b997f75e5e513d4eb.tar.gz
snap-1f750eb56047320f5c835c8b997f75e5e513d4eb.zip
add ANY KEY to key hat block (fix #387)
-rw-r--r--blocks.js1
-rw-r--r--objects.js10
2 files changed, 10 insertions, 1 deletions
diff --git a/blocks.js b/blocks.js
index 73ef884..381c5a3 100644
--- a/blocks.js
+++ b/blocks.js
@@ -953,6 +953,7 @@ SyntaxElementMorph.prototype.labelPart = function (spec) {
null,
false,
{
+ 'any key': ['any key'],
'up arrow': ['up arrow'],
'down arrow': ['down arrow'],
'right arrow': ['right arrow'],
diff --git a/objects.js b/objects.js
index 4be213a..ecde750 100644
--- a/objects.js
+++ b/objects.js
@@ -3483,7 +3483,15 @@ SpriteMorph.prototype.allHatBlocksForKey = function (key) {
return this.scripts.children.filter(function (morph) {
if (morph.selector) {
if (morph.selector === 'receiveKey') {
- return morph.inputs()[0].evaluate()[0] === key;
+ var selectedOption = morph.inputs()[0].evaluate()[0];
+
+ if (selectedOption === 'any key') {
+ return true;
+ }
+ if (selectedOption === key) {
+ return true;
+ }
+ return false;
}
}
return false;