2020 ソフトウェア設計及び演習用の班Wiki
19::gr04::key
プログラム
enchant();
function game_key(game, startTime){ var endTime; var num; var sec; var push = 0; var key = [0, 0]; endTime = new Date();
if(game.input.left){
if (push 0){
key[0] = 1;
endTime = new Date();
push = 1;
}
}
else if(game.input.right){
if (push 0){
key[0] = 4;
endTime = new Date();
push = 1;
}
}
else if(game.input.up){ if (push == 0){ key[0] = 2; endTime = new Date(); push = 1; } }
else if(game.input.down){ if (push == 0){ key[0] = 3; endTime = new Date(); push = 1; } }else{ key[0] = 0; sec = null; push = 0; } endTime2 = new Date();
if(key[0] >= 1) key[1] = 0.001 * endTime.getTime() - 0.001 * startTime.getTime(); else if(key[0] == 0) key[1] = null;
return key; }
function game_key_(game, startTime){ var fps = new Label(); var endTime; var num; var sec; var push = 0; var key; endTime = new Date();
fps.on( Event.ENTER_FRAME, function(){
if(game.input.left){
if (push 0){
key = 1;
endTime = new Date();
push = 1;
}
}
else if(game.input.right){
if (push 0){
key = 4;
endTime = new Date();
push = 1;
}
}
else if(game.input.up){ if (push == 0){ key = 2; endTime = new Date(); push = 1; } }
else if(game.input.down){ if (push == 0){ key = 3; endTime = new Date(); push = 1; } } else{ key = 0; sec = null; push = 0; } endTime2 = new Date();
this.text = '経過時間' + (0.001 * endTime2.getTime() - 0.001 * startTime.getTime()) + "秒" + '
key' + key + 'を押した時間:' + (0.001 * endTime.getTime() - 0.001 * startTime.getTime()) + '秒';
});
return fps; }
最終更新日:2019/08/01 16:39:04