@@ -12,6 +12,7 @@ export default class Controls extends PureComponent {
1212 this . cannonXPosition = this . props . width / 2
1313 this . translateY = new Animated . Value ( 0 )
1414 this . opacity = new Animated . Value ( 1 )
15+ this . coolDown = false
1516 }
1617
1718 componentDidMount ( ) {
@@ -33,6 +34,7 @@ export default class Controls extends PureComponent {
3334
3435 componentDidUpdate ( prevProps , prevState ) {
3536 if ( this . props . lives > 0 && prevProps . lives !== this . props . lives ) {
37+ // Effetto lampeggiante quando il cannone viene colpito
3638 Animated . sequence ( [
3739 Animated . timing ( this . opacity , {
3840 toValue : 0.2 ,
@@ -53,13 +55,12 @@ export default class Controls extends PureComponent {
5355 fire = ( ) => {
5456 const { fire } = this . props
5557
56- // Passa a fire() la posizione del cannone, per sincronizzare il proiettile
58+ // Prima della scadenza del periodo di cool down non si può sparare
5759 if ( ! this . coolDown ) {
5860 fire ( { x : this . cannonXPosition , y : options . cannonSize } )
5961 this . coolDown = true
6062 setTimeout ( ( ) => this . coolDown = false , options . rocketCoolDown )
6163 }
62-
6364 }
6465
6566 calculateCannonPosition ( offset ) {
@@ -115,7 +116,7 @@ const styles = StyleSheet.create({
115116 justifyContent : 'center'
116117 } ,
117118 flashView : {
118- // Senza background, su Android non fa l'animazione alla prima chiamata a CDU (!?)
119+ // Senza background su Android non fa l'animazione alla prima chiamata a cDU (!?)
119120 backgroundColor : 'rgba(0,0,0,0)'
120121 }
121122} )
0 commit comments