/zoeplat

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

« back to all changes in this revision

Viewing changes to zoetrope/sprites/tile.lua

  • Committer: Josh C
  • Date: 2013-03-02 20:40:57 UTC
  • Revision ID: josh@9ix.org-20130302204057-yrra0a51zgtpq2v2
zoetrope 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        -- image must be a nonsense value, not nil,
23
23
        -- for the tile to see that an image has been set if it
24
24
        -- was initially nil
25
 
        _set = { image = -1 },
 
25
        _set = { image = -1, imageOffset = { x = 0, y = 0 } },
26
26
 
27
27
        -- private property imageObj: actual Image instance used to draw
28
28
        -- this is normally set via the image property, but you may set it directly
31
31
        new = function (self, obj)
32
32
                obj = obj or {}
33
33
                self:extend(obj)
34
 
                obj._set.imageOffset = {}
35
34
                
36
35
                if obj.image then obj:updateQuad() end
37
36
                if obj.onNew then obj:onNew() end
61
60
                y = math.floor(y or self.y)
62
61
        
63
62
                if STRICT then
64
 
                        assert(type(x) == 'number', 'visible tile does not have a numeric x property')
65
 
                        assert(type(y) == 'number', 'visible tile does not have a numeric y property')
66
 
                        assert(type(self.width) == 'number', 'visible tile does not have a numeric width property')
67
 
                        assert(type(self.height) == 'number', 'visible tile does not have a numeric height property')
 
63
                        assert(type(x) == 'number', 'visible fill does not have a numeric x property')
 
64
                        assert(type(y) == 'number', 'visible fill does not have a numeric y property')
 
65
                        assert(type(self.width) == 'number', 'visible fill does not have a numeric width property')
 
66
                        assert(type(self.height) == 'number', 'visible fill does not have a numeric height property')
68
67
                end
69
68
 
70
69
                if not self.image then return end
100
99
                if colored then
101
100
                        love.graphics.setColor(255, 255, 255, 255)
102
101
                end
 
102
                        
 
103
                Sprite.draw(self, x, y)
103
104
        end,
104
105
 
105
106
        __tostring = function (self)