コード例 #1
0
ファイル: vehicule.py プロジェクト: Khopa/pyglet-taxi
    def draw(self, angle_impose=None):

        if angle_impose != None:
            angle = angle_impose
        else:
            angle = self.angle

        if self.is_walking:
            self.anim += 1
            if self.anim >= len(
                    VOITURE[NOM_VOITURE[self.perso]][self.type_anim]):
                self.anim = 0
        else:
            self.anim = 0

        # Determination sprite

        anim = VOITURE[NOM_VOITURE[self.perso]][self.type_anim][self.anim]

        # Affichage

        if self.alive and anim != None:
            prims.afficherRectangle(position=self.position,
                                    dimensions=TAILLE_VOITURE,
                                    angleY=angle,
                                    texture=anim)
            self.is_walking = False
コード例 #2
0
ファイル: pieton.py プロジェクト: Khopa/pyglet-taxi
    def afficher(self):

        angle = ((self.game.vehicule.angle%360)- self.angle%360)%360
            
        if angle < 45 or angle > 315:
            self.direction = 3
        elif 45 < angle < 135:
            self.direction = 1
        elif 135 < angle < 225:
            self.direction = 0
        elif 225 < angle < 315:
            self.direction = 2


        anim = PIETON[NOM_PIETON[self.image]][self.direction][self.animation]
        prims.afficherRectangle(position = [self.position[0], self.position[1]+self.saut, self.position[2]],
                                dimensions = TAILLE_VOITURE,
                                angleY = self.game.vehicule.angle,
                                angleZ = self.angle_x,
                                texture = anim)
コード例 #3
0
    def afficher(self):

        angle = ((self.game.vehicule.angle % 360) - self.angle % 360) % 360

        if angle < 45 or angle > 315:
            self.direction = 3
        elif 45 < angle < 135:
            self.direction = 1
        elif 135 < angle < 225:
            self.direction = 0
        elif 225 < angle < 315:
            self.direction = 2

        anim = PIETON[NOM_PIETON[self.image]][self.direction][self.animation]
        prims.afficherRectangle(position=[
            self.position[0], self.position[1] + self.saut, self.position[2]
        ],
                                dimensions=TAILLE_VOITURE,
                                angleY=self.game.vehicule.angle,
                                angleZ=self.angle_x,
                                texture=anim)
コード例 #4
0
ファイル: vehicule.py プロジェクト: Khopa/pyglet-taxi
    def draw(self, angle_impose = None):

        if angle_impose != None:
            angle = angle_impose
        else:
            angle = self.angle

        if self.is_walking:
            self.anim += 1
            if self.anim >= len(VOITURE[NOM_VOITURE[self.perso]][self.type_anim]):
                self.anim = 0
        else:
            self.anim = 0

        # Determination sprite

        anim = VOITURE[NOM_VOITURE[self.perso]][self.type_anim][self.anim]
        
        # Affichage

        if self.alive and anim != None:
            prims.afficherRectangle(position = self.position, dimensions = TAILLE_VOITURE, angleY = angle, texture = anim)
            self.is_walking = False
コード例 #5
0
    def draw(self, cam_pos):
        """
        Fonction d'affichage
        """

        if self.texture == 0:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTEZ, self.i, self.j)
        elif self.texture == 1:
            disp.afficher_bloc(disp.ID_PAVE, self.i, self.j)
            # Gestion du cas ou la camera est dans le mur, alors, on l'affiche pas
            if int(self.p0[0] / TAILLE_BLOC) == int(cam_pos[0]) and int(
                    self.p0[2] / TAILLE_BLOC) == int(cam_pos[1]):
                pass
            else:
                disp.afficher_bloc(self.RANDOM_ID, self.i, self.j)
        elif self.texture == 2:
            disp.afficher_bloc(disp.ID_PAVE, self.i, self.j)
        elif self.texture == 3:
            disp.afficher_bloc(disp.ID_PARC, self.i, self.j)
            # Cette ligne ne peut etre stockee dans la display list, car l'affichage de l'arbre est dynamique (depend de l'angle de la camera)
            prims.afficherRectangle(position = self.position_centrale,\
                                                dimensions = TAILLE_ARBRE, angleY = self.parent.parent.vehicule.angle,
                                                texture = TEXTURE_ARBRE)
        elif self.texture == 4:
            disp.afficher_bloc(disp.ID_PASSAGE, self.i, self.j)
        elif self.texture == 5:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTEX, self.i, self.j)
        elif self.texture == 6:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTES, self.i, self.j)
        elif self.texture == 7:
            disp.afficher_bloc(disp.ID_PARC, self.i, self.j)
        elif self.texture == 8:
            disp.afficher_bloc(disp.ID_HAIE, self.i, self.j)
        elif self.texture == 9:
            if int(self.p0[0] / TAILLE_BLOC) == int(cam_pos[0]) and int(
                    self.p0[2] / TAILLE_BLOC) == int(cam_pos[1]):
                pass
            else:
                disp.afficher_bloc(disp.ID_FALAISE, self.i, self.j)
        elif self.texture == 10:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTES, self.i, self.j)
            disp.afficher_bloc(disp.ID_TUNNEL, self.i, self.j)
        elif self.texture == 11:
            disp.afficher_bloc(disp.ID_MAISON, self.i, self.j)
        elif self.texture == 12:
            disp.afficher_bloc(disp.ID_PAVE, self.i, self.j)

            if self.parent.parent.vehicule.destination_client == [
                    self.i, self.j
            ]:
                prims.afficherRectangle(position = [self.position_centrale[0],self.d_fleche, self.position_centrale[2]],\
                                                dimensions = TAILLE_ARBRE, angleY = self.parent.parent.vehicule.angle,
                                                texture = FLECHE2)
                if self.sens_fleche == 0:
                    self.d_fleche += 0.1
                    if self.d_fleche >= 1: self.sens_fleche = 1
                else:
                    self.d_fleche -= 0.1
                    if self.d_fleche <= 0: self.sens_fleche = 0

        for p in self.listePieton:
            p.actualiser()
            p.afficher()
コード例 #6
0
ファイル: ville.py プロジェクト: Khopa/pyglet-taxi
    def draw(self, cam_pos):
        """
        Fonction d'affichage
        """

        if self.texture == 0: 
            disp.afficher_bloc(disp.ID_DESSIN_ROUTEZ, self.i, self.j) 
        elif self.texture == 1:
            disp.afficher_bloc(disp.ID_PAVE, self.i, self.j)
            # Gestion du cas ou la camera est dans le mur, alors, on l'affiche pas
            if int(self.p0[0]/TAILLE_BLOC) == int(cam_pos[0]) and int(self.p0[2]/TAILLE_BLOC) == int(cam_pos[1]):
                pass
            else:
                disp.afficher_bloc(self.RANDOM_ID, self.i, self.j) 
        elif self.texture == 2:
            disp.afficher_bloc(disp.ID_PAVE, self.i, self.j)
        elif self.texture == 3:
            disp.afficher_bloc(disp.ID_PARC, self.i, self.j)
            # Cette ligne ne peut etre stockee dans la display list, car l'affichage de l'arbre est dynamique (depend de l'angle de la camera)
            prims.afficherRectangle(position = self.position_centrale,\
                                                dimensions = TAILLE_ARBRE, angleY = self.parent.parent.vehicule.angle,
                                                texture = TEXTURE_ARBRE)
        elif self.texture == 4:
            disp.afficher_bloc(disp.ID_PASSAGE, self.i, self.j) 
        elif self.texture == 5:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTEX, self.i, self.j) 
        elif self.texture == 6:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTES, self.i, self.j) 
        elif self.texture == 7:
            disp.afficher_bloc(disp.ID_PARC, self.i, self.j) 
        elif self.texture == 8:
            disp.afficher_bloc(disp.ID_HAIE, self.i, self.j)
        elif self.texture == 9:
            if int(self.p0[0]/TAILLE_BLOC) == int(cam_pos[0]) and int(self.p0[2]/TAILLE_BLOC) == int(cam_pos[1]):
                pass
            else:
                disp.afficher_bloc(disp.ID_FALAISE, self.i, self.j) 
        elif self.texture == 10:
            disp.afficher_bloc(disp.ID_DESSIN_ROUTES, self.i, self.j) 
            disp.afficher_bloc(disp.ID_TUNNEL, self.i, self.j)
        elif self.texture == 11:
            disp.afficher_bloc(disp.ID_MAISON, self.i, self.j)
        elif self.texture == 12:
            disp.afficher_bloc(disp.ID_PAVE, self.i, self.j)

            if self.parent.parent.vehicule.destination_client == [self.i, self.j]:
                prims.afficherRectangle(position = [self.position_centrale[0],self.d_fleche, self.position_centrale[2]],\
                                                dimensions = TAILLE_ARBRE, angleY = self.parent.parent.vehicule.angle,
                                                texture = FLECHE2)
                if self.sens_fleche == 0:
                    self.d_fleche += 0.1
                    if self.d_fleche >= 1: self.sens_fleche = 1
                else:
                    self.d_fleche -= 0.1
                    if self.d_fleche <= 0: self.sens_fleche = 0
                


        for p in self.listePieton:
            p.actualiser()
            p.afficher()