1
因此,在我的最終狀態下,我希望用戶輸入他們的首字母縮寫。我已經設置了一個包含所有字母的數組,觸發器選擇一個字母和font_draw,但是看起來不能,但是我得到一個錯誤,說我的函數沒有定義。有任何想法嗎?用戶輸入首字母縮寫 - ImpactJS
userInitials: function(){
io_clear();
a = 0
l[0] = " "
l[1] = "a"
l[2] = 'b'
l[3] = 'c'
l[4] = 'd'
l[5] = 'e'
l[6] = 'f'
l[7] = 'g'
l[8] = 'h'
l[9] = 'i'
l[10] = 'j'
l[11] = 'k'
l[12] = 'l'
l[13] = 'm'
l[14] = 'n'
l[15] = 'o'
l[16] = 'p'
l[17] = 'q'
l[18] = 'r'
l[19] = 's'
l[20] = 't'
l[21] = 'u'
l[22] = 'v'
l[23] = 'w'
l[24] = 'x'
l[25] = 'y'
l[26] = 'z'
str = ""
if(ig.input.pressed('up')){
if (a>26){
a+= 1;
}else{
a = 0;
}
}
if(ig.input.pressed('down')){
if (a<0){
a -= 1;
}else{
a = 26;
}
}
this.font_draw(x,y,str+'['+1[a]+'] ');
if(ig.input.pressed('space')){
str += l[a];
}
},
draw:function(){
if(this.gameOver){
this.font.draw(userInitials, ig.system.width/2, 95, ig.Font.ALIGN.CENTER);
}
只是固定的函數調用。忘記調用this.userInitials。 – JMP 2013-02-12 01:39:52