     window.requestAnimationFrame => @frame()
     @assets.toggleBgMusicPlayback()
 
-  renderBackground: ->
+  drawBackground: ->
     @ctx.clearRect 0, 0, @width, @height
 
   updateExplosions: ->
     for explosion of @explosions
       @explosions[explosion].update()
 
-  renderExplosions: ->
+  drawExplosions: ->
     for explosion of @explosions
-      @explosions[explosion].render()
+      @explosions[explosion].draw()
 
   updateProjectiles: ->
     for projectile of @projectiles
       @projectiles[projectile].update()
 
-  renderProjectiles: ->
+  drawProjectiles: ->
     for projectile of @projectiles
-      @projectiles[projectile].render()
+      @projectiles[projectile].draw()
 
   updateEnemies: ->
     for enemy of @enemies
       @enemies[enemy].update()
 
-  renderEnemies: ->
+  drawEnemies: ->
     for enemy of @enemies
-      @enemies[enemy].render()
+      @enemies[enemy].draw()
 
   handleCollisions: ->
     for projectile of @projectiles


class Cannonball extends Projectile

  constructor: (@x, @y, @game)->
    @image = @game.assets.cannonball
    super @game
    @width   = 25
    @height  = @width
    @speed   = 20
    @strenth = 1


        if (@projectiles[projectile] != undefined) and (@isCollision @projectiles[projectile], @enemies[enemy])
          @killEnemy @enemies[enemy]
          @removeProjectile @projectiles[projectile]
          return

  killEnemy: (enemy)->
    @enemies.splice @enemies.indexOf(enemy), 1
    @addExplosion new Explosion(enemy.x, enemy.y, @)
    unless @enemy instanceof BounceEnemy
      @flashRed()

  flashRed: ->
    @ctx.fillStyle = '#dd0000'
    @ctx.fillRect 0, 0, @width, @height

  addEnemy: ->
    # if @enemies.length < 10
    #   @enemies.push @randomShip()
    @enemies.push @randomShip()

  randomShip: ->
    type = Math.floor(Math.random() * 3)
