Commit 9db86fcc authored by Eben Blaisdell's avatar Eben Blaisdell
Browse files

dzParseInt in index.js

parent d72add18
...@@ -335,14 +335,17 @@ builtinfuncs = { ...@@ -335,14 +335,17 @@ builtinfuncs = {
bimove:function(scope){ bimove:function(scope){
//console.log("move"); //console.log("move");
scope.interp.block.move(ea(0,scope)); scope.interp.block.move(ea(0,scope));
return "";
}, },
bimessage:function(scope){ bimessage:function(scope){
//console.log("sendMessage"); //console.log("sendMessage");
scope.interp.block.sendMessage(ea(0,scope)); scope.interp.block.sendMessage(ea(0,scope));
return "";
}, },
biattack:function(scope){ biattack:function(scope){
//console.log("sendMessage"); //console.log("sendMessage");
scope.interp.block.attack(ea(0,scope)); scope.interp.block.attack(ea(0,scope));
return "";
}, },
biisOpen:function(scope){ biisOpen:function(scope){
//console.log("sendMessage"); //console.log("sendMessage");
......
...@@ -474,6 +474,9 @@ Block.prototype.move = function(dir){ ...@@ -474,6 +474,9 @@ Block.prototype.move = function(dir){
this.actions--; this.actions--;
if(this.isOpen(dir)) { if(this.isOpen(dir)) {
dir = parseInt(dir); dir = parseInt(dir);
if(dir==NaN){
return;
}
dir = this.untransformDir(dir); dir = this.untransformDir(dir);
newx = this.x + Block.dx(dir); newx = this.x + Block.dx(dir);
newy = this.y + Block.dy(dir); newy = this.y + Block.dy(dir);
...@@ -489,6 +492,9 @@ Block.prototype.attack = function(dir) { ...@@ -489,6 +492,9 @@ Block.prototype.attack = function(dir) {
} }
this.actions--; this.actions--;
dir = parseInt(dir); dir = parseInt(dir);
if(dir==NaN){
return;
}
dir = this.untransformDir(dir); dir = this.untransformDir(dir);
attackx = this.x + Block.dx(dir); attackx = this.x + Block.dx(dir);
attacky = this.y + Block.dy(dir); attacky = this.y + Block.dy(dir);
...@@ -507,6 +513,9 @@ Block.prototype.sendMessage = function(dir){ ...@@ -507,6 +513,9 @@ Block.prototype.sendMessage = function(dir){
//console.log("sendMessage"); //console.log("sendMessage");
//console.log(dir); //console.log(dir);
dir = parseInt(dir); dir = parseInt(dir);
if(dir==NaN){
return;
}
dir = this.untransformDir(dir); dir = this.untransformDir(dir);
messagex = this.x + Block.dx(dir); messagex = this.x + Block.dx(dir);
messagey = this.y + Block.dy(dir); messagey = this.y + Block.dy(dir);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment