Esempio n. 1
0
 def event(self, ev):
     if ev.type == graphics.const.MOUSEBUTTONDOWN:
         self.click_at = time.time()
         x, y = ev.abs_pos
         y -= self.image.get_height()
         x -= self.image.get_width() / 2
         self.tooltip = ui.Tooltip(self.action_name, (x, y-40), color=(0, 255, 255))
         return ui.LOCK_MOUSE_EVENT
     if ev.type == graphics.const.MOUSEBUTTONUP:
         if self.tooltip:
             self.tooltip.remove()
         if time.time() - 0.5 > self.click_at:
             return
         x, y = ev.pos
         if x < 0 or y < 0 or x > self.size[0] or y > self.size[1]:
             return
         self.click()
Esempio n. 2
0
 def initTooltip(self):
     """For bugfixing"""
     self.tooltip = ui.Tooltip('BLANK TOOLTIP',
                               (self.rect.left + 3, self.rect.top))
Esempio n. 3
0
 def initTooltip(self):
     """Initialises a tooltip that appears when the mob is hovered"""
     tooltipPos = (self.rect.right + ui.GAP, self.rect.top)
     self.tooltip = ui.Tooltip(
         'This ' + self.name + ' is under construction', tooltipPos)
     self.tooltip.topleft = tooltipPos