原型变量未定义

时间:2015-10-05 08:35:34

标签: javascript

在大学时我需要创建一个带有模型视图控制器样式编码的javascript游戏。我正在尝试编写播放器输入,但我的控制器由于某种原因无法访问library(stringdist) #Reading the two files to be compared and making sure that I'm dealing with characters companies.unstructured <- read.csv( "https://www.dropbox.com/s/opbk0s2q14l5c71/unstructured_companies.csv?dl=0", sep = ";", stringsAsFactors = FALSE ) companies.structured <- read.csv( "https://www.dropbox.com/s/kyi0rvz77frr7sd/structured_companies_w_CVR.csv?dl=0", sep=";", stringsAsFactors = FALSE ) #Using the match function to match up all 100% identical companies to avoid unnecessary workload for the Jaro-Winkler loop companies.unstructured$CVR = companies.structured$CVR[match(companies.unstructured$Company, companies.structured$Company)] companies.exact.match <- companies.unstructured[!is.na(companies.unstructured$CVR), ] #Creating a subset to work on with the Jaro-Winkler loop. companies.unstructured.na <- subset(companies.unstructured, is.na(CVR)) #And here's the loop measuring the distance between the company names using the Jaro-Winkler algorithm. distance.methods<- c('jw') dist.methods<-list() for(m in 1:length(distance.methods)) { dist.name.enh<-matrix(NA, ncol = length(companies.structured$Company), nrow = length(companies.unstructured.na$Company)) for(i in 1:length(companies.structured$Company)) { for(j in 1:length(companies.unstructured.na$Company)) { dist.name.enh[j,i]<-stringdist(tolower(companies.structured[i,]$Company), tolower(companies.unstructured.na[j,]$Company), method = distance.methods[m]) } } dist.methods[[distance.methods[m]]]<-dist.name.enh } #matching up pairs of minimum distance match.s1.s2.enh<-NULL for(m in 1:length(dist.methods)) { dist.matrix<-as.matrix(dist.methods[[distance.methods[m]]]) min.name.enh<-apply(dist.matrix, 1, base::min) for(i in 1:nrow(dist.matrix)) { s2.i<-match(min.name.enh[i],dist.matrix[i,]) s1.i<-i match.s1.s2.enh<-rbind(data.frame(s2.i=s2.i, s1.i=s1.i, s1Company=companies.unstructured.na[s1.i,]$Company, s2Company=companies.structured[s2.i,]$Company, CVR=companies.structured[s2.i,]$CVR, adist=min.name.enh[i], method=distance.methods[m]), match.s1.s2.enh) } } 变量。有人能帮助我吗?

INPUT:

movesRight

运动:

GOBLINS.View.prototype.input = function() {

    var self = this;
    this.movesRight = false;

    window.addEventListener('keydown', keyDown, true);

    function keyDown(e){
        if(e.keyCode == 39){
            self.movesRight = true;
            console.log(self.movesRight);
        };
    };
};

控制器:

GOBLINS.View.prototype.movement = function(character){
            character.xpos++;
    };

0 个答案:

没有答案