Atölye › Bilardo › 15/33. adım
Oyunun amacı masayı olabildiğince az vuruşla temizlemek olacak. Bu yüzden vuruşları sayacağız ve masanın üstünde göstereceğiz.
```js
let shots
shots = 0
shots += 1
ctx.fillStyle = 'white'
ctx.font = 'bold 16px sans-serif'
ctx.textAlign = 'left'
ctx.fillText('Shots ' + shots, LEFT, 22)
```let shots → vuruş sayısı; reset içinde shots = 0.shoot içinde shots += 1 → if (state !== 'aiming') return'ün altında olduğu için yalnız gerçekten vurulunca
sayar.LEFT kadar içeride.let power satırının altına let shots yaz.reset içinde power = 8 satırının altına shots = 0 yaz.shoot içinde state = 'rolling' satırının üstüne shots += 1 yaz.draw'ın sonunda top döngüsünün kapanan }'sinden sonra bir boş satır bırak ve dört yazı satırını yaz.Shots 0 görmelisin; her vuruşta artmalı.Beceriler: Oyun durumları, Canvas üzerine çizim
← Yuvarlanırken nişanı gizle Değen toplar →