Esempio n. 1
0
    def createMovePaperInterval(self, newY):
        here = self.calcPaperPos(self.paperY)
        there = self.calcPaperPos(newY)

        posInterval = LerpPosInterval(self.target,
                                      abs(newY - self.paperY),
                                      there,
                                      startPos=here,
                                      blendType='easeInOut')

        posInterval.setDoneEvent('scrollDone')

        def isDone():
            self.paperY = newY

        self.base.acceptOnce('scrollDone', isDone)
        return posInterval
Esempio n. 2
0
    def createMovePaperInterval(self, newY):
        here = self.calcPaperPos(self.paperY)
        there = self.calcPaperPos(newY)

        posInterval = LerpPosInterval(
                self.target, abs(newY - self.paperY),
                there,
                startPos = here,
                blendType='easeInOut')

        posInterval.setDoneEvent('scrollDone')

        def isDone():
            self.paperY = newY

        self.base.acceptOnce('scrollDone', isDone)
        return posInterval
Esempio n. 3
0
    def createMoveCarriageInterval(self, newX, curX=None):
        if curX is None:
            curX = self.paperX
        here = self.calcCarriage(curX)
        there = self.calcCarriage(newX)

        posInterval = LerpPosInterval(self.carriageNP,
                                      abs(newX - curX),
                                      there,
                                      startPos=here,
                                      blendType='easeIn')

        posInterval.setDoneEvent('carriageReset')

        def isReset():
            self.paperX = newX

        self.base.acceptOnce('carriageReset', isReset)
        return posInterval
Esempio n. 4
0
    def createMoveCarriageInterval(self, newX, curX=None):
        if curX is None:
            curX = self.paperX
        here = self.calcCarriage(curX)
        there = self.calcCarriage(newX)

        posInterval = LerpPosInterval(
                self.carriageNP, abs(newX - curX),
                there,
                startPos = here,
                blendType='easeIn')

        posInterval.setDoneEvent('carriageReset')

        def isReset():
            self.paperX = newX

        self.base.acceptOnce('carriageReset', isReset)
        return posInterval
Esempio n. 5
0
 def enemy_shoot_task(self, task):
     for t in tanks_list:
         ShootAt = tanks_dict[t]["tank"].getRelativePoint(
             self.camera, (0 + random(), 0 + random(), 0 + random()))
         ShootAt = LVecBase2d(ShootAt[0], ShootAt[1]).normalized()
         if ShootAt[0] > 0.99999 and not tanks_dict[t]["shooting"]:
             print('Tank {} shooting'.format(t))
             tanks_dict[t]["shooting"] = True
             tanks_dict[t]["round"].wrtReparentTo(render)
             ShootAt = render.getRelativeVector(tanks_dict[t]["tank"],
                                                (1, 0, 0))
             i = LerpPosInterval(tanks_dict[t]["round"],
                                 1,
                                 pos=(tanks_dict[t]["round"].getPos() +
                                      ShootAt * 300))
             i.setDoneEvent('shot{}-done'.format(t))
             i.start()
             self.enemyShot_snd.play()
     return Task.cont
Esempio n. 6
0
    def shoot(self):

        self.tank_round[0].setPos(0, 20, -0.2)
        self.sight_engaged_np.show()
        self.sight_clear_np.hide()

        self.tank_round[0].wrtReparentTo(render)
        # print(self.tank_round[0].getPos(), self.tank_round[0].getHpr())
        ShootAt = render.getRelativeVector(base.camera, (0, 1, 0))
        # self.tank_round[0].setPos(self.tank_round[0].getPos() + ShootAt)

        self.tank_round[0].show()
        self.mainShot_snd.play()
        i = LerpPosInterval(self.tank_round[0],
                            1.1,
                            pos=(self.tank_round[0].getPos() + ShootAt * 200))
        i.setDoneEvent('shot-done')
        i.start()
        # print(ShootAt)
        return