/ld27

To get this branch, use:
bzr branch http://9ix.org/bzr/ld27

« back to all changes in this revision

Viewing changes to zoetrope/sprites/tile.lua

  • Committer: Josh C
  • Date: 2013-08-25 22:47:18 UTC
  • Revision ID: josh@9ix.org-20130825224718-c93zymxgkm9r3kjh
play silly sound on level switch

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                end
55
55
        end,
56
56
 
57
 
        draw = function (self, x, y)
 
57
        draw = function (self, x, y, map)
58
58
                if not self.visible or self.alpha <= 0 then return end
59
59
 
60
60
                x = math.floor(x or self.x)
92
92
                if self.flipX then scaleX = scaleX * -1 end
93
93
                if self.flipY then scaleY = scaleY * -1 end
94
94
 
95
 
                love.graphics.drawq(self._imageObj, self._quad, x + self.width / 2, y + self.height / 2, self.rotation,
96
 
                                                        scaleX, scaleY, self.width / 2, self.height / 2)
97
 
                
 
95
    if map then
 
96
       batches = map.spriteBatches
 
97
 
 
98
       if not batches[self.image] then
 
99
          --batches:addBatch(self.image, self._imageObj)
 
100
          local maph, mapw = map:getMapSize()
 
101
          batches[self.image] = love.graphics.newSpriteBatch(self._imageObj, mapw * maph)
 
102
          print('adding new batch')
 
103
       end
 
104
 
 
105
       batches[self.image]:addq(self._quad, x + self.width / 2, y + self.height / 2, self.rotation, scaleX, scaleY, self.width / 2, self.height / 2)
 
106
    else
 
107
 
 
108
       love.graphics.drawq(self._imageObj, self._quad, x + self.width / 2, y + self.height / 2, self.rotation,
 
109
                           scaleX, scaleY, self.width / 2, self.height / 2)
 
110
                end
 
111
 
98
112
                -- reset color
99
113
                
100
114
                if colored then