Example #1
0
 def showMessage(
     self,
     message="Your game must be restarted in order to apply these settings."
 ):
     if not self.active:
         self.lbl.element.text = message
         self.do(
             actions.AccelDeccel(
                 actions.MoveTo((int(self.x), 0), duration=0.5)))
         self.active = True
Example #2
0
    def __init__(self, width=None, height=None):
        super().__init__(100, 100, 100, 100, width=width, height=height)
        self.width = reswidth
        self.height = int(resheight * 0.07)
        self.x = 0
        self.y = resheight
        self.showAction = actions.AccelDeccel(
            actions.MoveTo((self.x, resheight - self.height), 0.5))
        self.hideAction = actions.AccelDeccel(
            actions.MoveTo((self.x, resheight), 0.5))

        self.lbl = text.Label("",
                              anchor_x="center",
                              anchor_y="center",
                              font_size=18)
        self.lbl.x = self.width / 2
        self.lbl.y = self.height / 2

        self.active = False

        self.add(self.lbl)
Example #3
0
    def test_update_1_called(self):
        global rec
        duration = 2.0
        original_action = UIntervalAction('original', duration)
        modified_action = ac.AccelDeccel(original_action)

        node = CocosNode()
        node.do(modified_action)
        dt = duration * 1.0
        rec = []
        node._step(dt)
        print('rec:', rec)
        update_record = rec[-1]
        assert update_record[1] == 'update'
        assert update_record[2] == 1.0