<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://travaux.indse.be/index.php?action=history&amp;feed=atom&amp;title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame</id>
	<title>Programmation des bases d'un jeu vidéo sous Pygame - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://travaux.indse.be/index.php?action=history&amp;feed=atom&amp;title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame"/>
	<link rel="alternate" type="text/html" href="https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;action=history"/>
	<updated>2026-05-10T17:56:04Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;diff=17511&amp;oldid=prev</id>
		<title>Louis.martin@indse.be : /* Première fenêtre */</title>
		<link rel="alternate" type="text/html" href="https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;diff=17511&amp;oldid=prev"/>
		<updated>2018-10-25T13:44:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Première fenêtre&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 25 octobre 2018 à 15:44&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l12&quot;&gt;Ligne 12 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 12 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Les commandes à utiliser sont :&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Les commandes à utiliser sont :&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  -&amp;quot;win = pygame.display.&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;set.mode&lt;/del&gt;((x,y))&amp;quot; permet de crée la fenêtre à la taille désirée.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  -&amp;quot;win = pygame.display.&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;set_mode&lt;/ins&gt;((x,y))&amp;quot; permet de crée la fenêtre à la taille désirée.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  -&amp;quot;pygame.display.set_caption(&amp;quot;name&amp;quot;)&amp;quot; permet de nommer la fenêtre.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  -&amp;quot;pygame.display.set_caption(&amp;quot;name&amp;quot;)&amp;quot; permet de nommer la fenêtre.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Louis.martin@indse.be</name></author>
	</entry>
	<entry>
		<id>https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;diff=16944&amp;oldid=prev</id>
		<title>Cyril.gusbin@indse.be : /* Importer Pygame */</title>
		<link rel="alternate" type="text/html" href="https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;diff=16944&amp;oldid=prev"/>
		<updated>2018-06-18T13:26:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Importer Pygame&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;a href=&quot;https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;amp;diff=16944&amp;amp;oldid=16886&quot;&gt;Voir les modifications&lt;/a&gt;</summary>
		<author><name>Cyril.gusbin@indse.be</name></author>
	</entry>
	<entry>
		<id>https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;diff=16886&amp;oldid=prev</id>
		<title>Cyril.gusbin@indse.be : Page créée avec « Programmation des bases d'un jeu vidéo sous Pygame  == Importer Pygame == J'ai déjà fait une autre page wiki pour expliquer comment installer Pygame. Maintenant, je vai... »</title>
		<link rel="alternate" type="text/html" href="https://travaux.indse.be/index.php?title=Programmation_des_bases_d%27un_jeu_vid%C3%A9o_sous_Pygame&amp;diff=16886&amp;oldid=prev"/>
		<updated>2018-06-06T16:23:22Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « Programmation des bases d&amp;#039;un jeu vidéo sous Pygame  == Importer Pygame == J&amp;#039;ai déjà fait une autre page wiki pour expliquer comment installer Pygame. Maintenant, je vai... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Programmation des bases d'un jeu vidéo sous Pygame&lt;br /&gt;
&lt;br /&gt;
== Importer Pygame ==&lt;br /&gt;
J'ai déjà fait une autre page wiki pour expliquer comment installer Pygame. Maintenant, je vais vous expliquer comment importer les fonctions Pygame dans Python.&lt;br /&gt;
Les commandes à utiliser sont : &lt;br /&gt;
 -&amp;quot;import pygame&amp;quot; qui va importer tous les éléments pygame&lt;br /&gt;
 -&amp;quot;from pygame.locals import *&amp;quot; cette fonction permet de savoir exactement ce qu'on importe de pygame, vous devez écrire une commande à la place de l'astérisque.&lt;br /&gt;
 -&amp;quot;pygame.init()&amp;quot; va initialiser tous les éléments que nous avons importer.&lt;br /&gt;
&lt;br /&gt;
=== Première fenêtre ===&lt;br /&gt;
Les commandes à utiliser sont :&lt;br /&gt;
 -&amp;quot;win = pygame.display.set.mode((x,y))&amp;quot; permet de crée la fenêtre à la taille désirée.&lt;br /&gt;
 -&amp;quot;pygame.display.set_caption(&amp;quot;name&amp;quot;)&amp;quot; permet de nommer la fenêtre.&lt;br /&gt;
&lt;br /&gt;
Pour pouvoir fermer la fenêtre:&lt;br /&gt;
 -Vous devez d'abord créer une variable &amp;quot;continuer&amp;quot;, vous pouvez lui donner la valeur &amp;quot;1&amp;quot;&lt;br /&gt;
 -Créer votre boucle principale &amp;quot;while continuer ==1&amp;quot;&lt;br /&gt;
 -Ensuite le code permettant de fermer la fenêtre doit ressembler à ça :&lt;br /&gt;
     -for event in pygame.event.get():(Cela permet de prendre en compte tous les événements qui suivent)&lt;br /&gt;
        -if event.type == pygame.QUIT:( = si l’événement effectué est &amp;quot;fermer la fenêtre&amp;quot;)&lt;br /&gt;
            -continuer = 0 (la valeur de continuer devient 0 stoppant la boucle)&lt;br /&gt;
            -pygame.quit() (cette fonction arrête le programme)&lt;br /&gt;
            -exit() (cette fonction ferme la fenêtre)&lt;br /&gt;
&lt;br /&gt;
==== Premiers déplacements, limites de l'écran ====&lt;br /&gt;
 -D'abord nous allons attribuer au mot keys commande de pression d'une touche, comme cela &amp;quot;keys = pygame.key.get_pressed()&amp;quot;&lt;br /&gt;
 - Nous allons créer une variable &amp;quot;vel=x&amp;quot; le x sera la valeur du déplacement vers la droite ou la gauche&lt;br /&gt;
 - nous allons faire sorte que &amp;quot;si la touche gauche est pressée on modifie la coordonnée x du personnage de -vel sinon si la touche droite est pressée on modifie la coordonné du personnage de + vel&amp;quot;, Voici le code :  &lt;br /&gt;
    51.if keys[pygame.K_LEFT] and x &amp;gt; vel :&lt;br /&gt;
        52.x -= vel&lt;br /&gt;
        53.left = True&lt;br /&gt;
        54.right=False&lt;br /&gt;
    55.elif keys[pygame.K_RIGHT] and x &amp;lt; 500 - width - vel :&lt;br /&gt;
        56.x += vel&lt;br /&gt;
        57.left=False&lt;br /&gt;
        58.right=True&lt;br /&gt;
    59.else:&lt;br /&gt;
        60.right=False&lt;br /&gt;
        61.left=False&lt;br /&gt;
        62.walcount=0&lt;br /&gt;
 - dans if et elif (ligne 51 et 55) les deux deuxièmes conditions vont limiter l'écran en empêchant la commande keys de s'activer si on se trouve à une certaine position ( width est une variable qui représente la largeur du personnage dans mon programme sa valeur est 64)&lt;/div&gt;</summary>
		<author><name>Cyril.gusbin@indse.be</name></author>
	</entry>
</feed>