私は子供向けのシューティングゲームを作成しています。数字は下から上に向かっていて、質問に一致する正しい数字をクリックする必要があります。
私は現在、このコードを使用して、数字を下から上に移動し始めています
var bWidth = $('#' + id).width();
var bHeight = $('#' + id).css('top', '400px').fadeIn(1000).animate({
'top': '-100px'
}, 7000).fadeOut(1000);
問題は、ユーザーが正解を取得したら、別のアニメーションを使用して正解を示します。間違った答えについても同じです。
$(".character").click(function () {
$(this).stop();
if ($(this).hasClass("clock")) {
if ($(this).hasClass("up")) {
$(this).effect("explode", 300);
count += 5;
} else if ($(this).hasClass("down")) {
$(this).effect("bounce", {
times: 2,
direction: 'left'
}, 300, function() {
$(this).slideUp('fast');
});
count -= 5;
}
$('#timer').text(count);
} else {
if ($(this).hasClass("wrong")) {
$(this).effect("bounce", {
times: 2,
direction: 'left'
}, 300, function() {
$(this).slideUp('fast');
});
miss++;
attempted++;
$("#miss").html("Wrong: " + miss);
} else {
$(this).effect("explode", 300);
hit++;
attempted++;
$("#hit").html("Right: " + hit);
correctlabels();
}
}
});
私の問題は、数字をクリックすると、2番目のアニメーションが開始する前に大きな一時停止があり、まったく機能しない場合があることです。
スムーズに動くように、誰かがこれを回避する方法を教えてくれないかと思っていました。ありがとう!
ここに役立つフィドルがあります:http://jsfiddle.net/pUwKb/19/