coffeescriptでじゃんけんゲームを作っていますが、下記コードで "unexpected indentation" と表示されどこが原因なのかわからず困っています。お分かりの方がいれば教えて下さいm(__)m
judgeJanken: (hand, rival) ->
if hand is rival
#(hand is 0 and rival is 0) or (hand is 1 and rival is 1) or (hand is 2 and rival is 2)
$('.answer02').text 'あいこ もう一回'
else if (hand + 1 is rival) or (hand is 2 and rival is 0)
#(hand is 0 and rival is 1) or (hand is 1 and rival is 2) or (hand is 2 and rival is 3)
$('.answer02').text '勝ち'
@my_lifepoint--
#@rival_lifepoint.pop()
if @rival_lifepoint is 2
$('.rival_lifepoint03 img').attr 'src', 'image/heart_black.png'
else if @rival_lifepoint is 1
$('.rival_lifepoint02 img').attr 'src', 'image_heart_black.png'
else if @rival_lifepoint is 0
$('.rival_lifepoint01 img').attr 'src', 'image_heart_black.png'
alert 'YOU ARE WIN'
else
$('.answer02').text '負け'
@my_lifepoint--
#@my_lifepoint.pop()
if @my_lifepoint is 2
$('.my_lifepoint03 img').attr 'src', 'image/heart_black.png'
else if @my_lifepoint is 1
$('.my_lifepoint02 img').attr 'src', 'image_heart_black.png'
else if @my_lifepoint is 0
$('.my_lifepoint01 img').attr 'src', 'image_heart_black.png'
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。