issue173:python
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | Dernière révisionLes deux révisions suivantes | ||
issue173:python [2021/09/30 12:32] – auntiee | issue173:python [2021/10/01 15:21] – auntiee | ||
---|---|---|---|
Ligne 267: | Ligne 267: | ||
**We will need to add some code in order to make the program show something other than just a pretty blue background. In your IDE or text editor, open the file 02_draw_sprites.py . This file is an expansion of the skeleton that we just ran. Between the constants at the top of the source code and the beginning of the class, you’ll see the following additional lines… | **We will need to add some code in order to make the program show something other than just a pretty blue background. In your IDE or text editor, open the file 02_draw_sprites.py . This file is an expansion of the skeleton that we just ran. Between the constants at the top of the source code and the beginning of the class, you’ll see the following additional lines… | ||
- | # Constants used to scale our sprites from their original size | + | # Constants used to scale our sprites from their original size |
CHARACTER_SCALING = 1 | CHARACTER_SCALING = 1 | ||
Ligne 276: | Ligne 276: | ||
These lines set the scaling for both the character sprite and the tiles. In the class, some code has been added to the class that sets up the character and some props. Between the super().__init__ line and the arcade.set_background_color line, you will see the following lines… | These lines set the scaling for both the character sprite and the tiles. In the class, some code has been added to the class that sets up the character and some props. Between the super().__init__ line and the arcade.set_background_color line, you will see the following lines… | ||
- | # These are ' | + | # These are ' |
- | # go into a list. | + | # go into a list. (entrer dans une liste) |
self.wall_list = None | self.wall_list = None | ||
Ligne 286: | Ligne 286: | ||
Il faut ajouter un peu de code pour que le programme affiche autre chose qu'un joli fond bleu. Dans votre IDE ou votre éditeur de texte, ouvrez le fichier 02_draw_sprites.py. Ce fichier est une expansion du squelette que nous venons d' | Il faut ajouter un peu de code pour que le programme affiche autre chose qu'un joli fond bleu. Dans votre IDE ou votre éditeur de texte, ouvrez le fichier 02_draw_sprites.py. Ce fichier est une expansion du squelette que nous venons d' | ||
- | # Constants used to scale our sprites from their original size | + | # Constants used to scale our sprites from their original size (Les constantes utilisées pour redimensionner nos sprites à partir de leur taille originale) |
CHARACTER_SCALING = 1 | CHARACTER_SCALING = 1 | ||
Ligne 295: | Ligne 296: | ||
Ces lignes définissent la mise à l' | Ces lignes définissent la mise à l' | ||
- | # These are ' | + | # These are ' |
+ | pour pouvoir suivre nos sprites. Chaque sprite devrait aller dans une liste.) | ||
# go into a list. | # go into a list. | ||
Ligne 318: | Ligne 320: | ||
The next part of the code is very important in that it creates the player sprite. The actual sprite image can be anything you like. To help new users along, the good people that created Arcade, included a few sprite images that you might need in the actual distribution package. If you look in your virtual environment at the / | The next part of the code is very important in that it creates the player sprite. The actual sprite image can be anything you like. To help new users along, the good people that created Arcade, included a few sprite images that you might need in the actual distribution package. If you look in your virtual environment at the / | ||
- | # Separate variable that holds the player sprite | + | # Separate variable that holds the player sprite |
self.player_sprite = None | self.player_sprite = None | ||
Ligne 344: | Ligne 346: | ||
Enfin, la fonction on_draw de notre classe est modifiée en ajoutant les lignes suivantes au bas de la fonction (après l' | Enfin, la fonction on_draw de notre classe est modifiée en ajoutant les lignes suivantes au bas de la fonction (après l' | ||
- | # Draw our sprites | + | # Draw our sprites |
self.wall_list.draw() | self.wall_list.draw() | ||
self.player_list.draw() | self.player_list.draw() |
issue173/python.txt · Dernière modification : 2021/10/03 17:09 de andre_domenech