コード例 #1
0
ファイル: GuiBattle.py プロジェクト: Gugu42/pykemon
    def runCurrentAnimation(self, font, game) :
        if self.currentAnimation == "trainer_in" :
            if self.animationTimer <= 80 :
                self.player_image.image.set_alpha(MathUtils.lerp(0, 255, self.animationTimer / 80));
                self.player_image.rect.x = MathUtils.lerp(-120, 240, self.animationTimer / 80);

                self.opponent_image.image.set_alpha(MathUtils.lerp(0, 255, self.animationTimer/80));
                self.opponent_image.rect.x = MathUtils.lerp(880, 440, self.animationTimer/80);
            else :
                self.animationActive = False;
                self.animationTimer = 0;
                self.currentAnimation = "none";
        elif self.currentAnimation == "opponent_exit" :
            if self.animationTimer <= 40 :
                self.opponent_image.image.set_alpha(MathUtils.lerp(255, 0, self.animationTimer/40));
            if self.animationTimer == 41 :
                self.opponent_pokemon = self.opponnent.getPokemon(0);
            if self.animationTimer > 41 :
                self.animationActive = False;
                self.animationTimer = 0;
                self.currentAnimation = "None";
                self.stepDone = True;
        elif self.currentAnimation == "player_exit" :
            if self.animationTimer <= 40 :
                self.player_image.image.set_alpha(MathUtils.lerp(255, 0, self.animationTimer/40));
            if self.animationTimer == 41 :
                self.player_pokemon = self.player.getFirstPokemonAlive();
            if self.animationTimer > 41 :
                self.animationActive = False;
                self.animationTimer = 0;
                self.currentAnimation = "None";
                self.stepDone = True;
                self.updateStatus("opponent", self.opponent_pokemon, True, font);
                self.updateStatus("player", self.player_pokemon, True, font);
        elif self.currentAnimation == "player_attack" :
            if self.animationTimer <= 10 :
                self.player_pokemon_x = MathUtils.lerp(232, 280, self.animationTimer/10);
            elif self.animationTimer > 10 and self.animationTimer <= 20 :
                self.player_pokemon_x = MathUtils.lerp(280, 232, (self.animationTimer-10)/10)
            elif self.animationTimer == 21 :
                self.animationActive = False;
                self.animationTimer = 0;
                self.currentAnimation = "None";
                self.stepDone = True;
                self.selectStep = False;
                self.attackStep = False;
                self.buttons = ["Attaque", "Inventaire", "Equipe", "Fuir"];
                #self.nextStep(game, font);
        elif self.currentAnimation == "opponent_attack" :
            if self.animationTimer <= 10 :
                self.opponent_pokemon_x = MathUtils.lerp(440, 398, self.animationTimer/10);
            elif self.animationTimer > 10 and self.animationTimer <= 20 :
                self.opponent_pokemon_x = MathUtils.lerp(398, 440, (self.animationTimer-10)/10)
            elif self.animationTimer == 21 :
                self.animationActive = False;
                self.animationTimer = 0;
                self.currentAnimation = "None";
                self.selectStep = False;
                self.attackStep = False;
                self.stepDone = True;
コード例 #2
0
ファイル: Player.py プロジェクト: Gugu42/pykemon
    def move(self, velocity, world, alreadyMoving, game):
        self.moving = True;

        if not alreadyMoving :
            self.movingTick = 0;
            self.oldX = self.posX;
            self.oldY = self.posY;
            self.newX = self.oldX + (self.velocity[0] * 16);
            self.newY = self.oldY + (self.velocity[1] * 16);
            tile = world.tileAt(self.newX, self.newY+6);
            if tile is not None and tile.occupied == True:
                self.posX = self.oldX;
                self.posY = self.oldY;
                self.moving = False;
            else :
                if tile is not None :
                    tile.onSteppedOn(self, game);
        else :
            if self.movingTick > 8 :
                self.movingTick = 0;
                self.moving = False;
                if self.keepMoving :
                    self.move(self.velocity, world, False);
            else :
                self.posX = MathUtils.lerp(self.oldX, self.newX, self.movingTick/8);
                self.posY = MathUtils.lerp(self.oldY, self.newY, self.movingTick/8);
                self.movingTick += 1;
コード例 #3
0
ファイル: Game.py プロジェクト: Gugu42/pykemon
 def fadeScreenOut(self, fadeTime) :
     self.fadeIn = False;
     if self.fadeImage.get_alpha() > 0 :
         self.fadeTime = fadeTime;
         self.fadeImage.set_alpha(MathUtils.lerp(255, 0, self.fadeProgress/self.fadeTime))
         self.fadeProgress += 1;
         if self.fadeProgress > self.fadeTime :
             self.fadeTime = 0;
             self.fadeProgress = 0;
コード例 #4
0
ファイル: Game.py プロジェクト: Gugu42/pykemon
 def fadeScreenIn(self, fadeTime) :
     self.fadeIn = True;
     if self.fadeImage.get_alpha() < 255 :
         self.fadeTime = fadeTime;
         self.fadeImage.set_alpha(MathUtils.lerp(0, 255, self.fadeProgress/self.fadeTime))
         self.fadeProgress += 1;
         if self.fadeProgress > self.fadeTime :
             self.fadeProgress = 0;
             self.fadeTime = 0;