/zoeplat

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

« back to all changes in this revision

Viewing changes to balloon.lua

  • Committer: Josh C
  • Date: 2013-03-09 05:02:20 UTC
  • Revision ID: josh@9ix.org-20130309050220-bd1ybunyhk8fhwyw
reapply jump animation after Y collision.  (there's a frame of no 
jumping no falling that I can't do anything about w/o doing better 
collision handling)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Balloon = Group:extend{
2
 
   visible = false,
3
 
   text = Text:new{wordWrap = true, width = 50, tint = {0,0,0}},
4
 
   box = Fill:new{width = 54, border = {0,0,255}},
5
 
   onNew = function(self)
6
 
              self:add(self.box)
7
 
              self:add(self.text)
8
 
              the.view:add(self)
9
 
              the.view:moveToBack(self)
10
 
              print('new balloon')
11
 
           end,
12
 
   onUpdate = function(self)
13
 
                 if self.visible then
14
 
                    local spr = self.sprite
15
 
                    self.text:centerAround(spr.x + (spr.width/2),
16
 
                                           spr.y + (spr.height/2), --ignored
17
 
                                           'horizontal')
18
 
                    _, texth = self.text:getSize()
19
 
                    self.text.y = spr.y - texth - 4
20
 
                    self.box.x = self.text.x - 2
21
 
                    self.box.y = self.text.y - 2
22
 
                 end
23
 
              end,
24
 
   setText = function(self, text)
25
 
                self.text.text = text
26
 
                _, texth = self.text:getSize()
27
 
                self.box.height = texth + 4
28
 
             end
29
 
}
 
 
b'\\ No newline at end of file'