« Soya/Python base 5 » : différence entre les versions

Contenu supprimé Contenu ajouté
Seb.bernery (discussion | contributions)
Création : # -*- indent-tabs-mode: t -*- # Soya 3D tutorial # Copyright (C) 2004 Jean-Baptiste LAMY # # This program is free software; you can redistribute it and/or modify # it under the terms of...
 
Seb.bernery (discussion | contributions)
Aucun résumé des modifications
Ligne 1 :
<pre>
# -*- indent-tabs-mode: t -*-
 
Ligne 22 ⟶ 23 :
 
# Dans cette leçon notre chenille va nous obéir !
# Vous allez apprendre comment utiliser les évenements de SDL avec Soya.
# You'll learn how to use SDL events with Soya.
# Utilisez les touches directionelles pour contrôler la chenille.
# Use the cursor arrows to control the caterpillar.
 
 
# Importation des modules de Soya.
# Import the Soya module.
# TheLe module soya.sdlconst modulecontient containstoutes allles theconstantes SDLde constantsSDL.
 
import sys, os, os.path, soya, soya.sdlconst
Ligne 34 ⟶ 35 :
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
 
# CreatesCréation ade la scene.
 
scene = soya.World()
 
 
# TheLa CaterpillarHeadclasse classCaterpillarHead isest verysimilaire similarà tola theclasse CaterpillarHead classde ofla theprécédente previousleçon.
# lesson.
 
class CaterpillarHead(soya.Body):
Ligne 51 :
soya.Body.begin_round(self)
# LoopsBoucle overde alltous les évenements Soya / SDL events.
# EachChaque eventévenement isest aun tuple ; thela firstpremière valuevaleur indicatesindique theles eventtypes type and the otherd'évènements
# valueset dependles onautres thevaleurs dépendant du type. The following event types exist :
# - (KEYDOWN, keysym, modifier) where keysym is the key's code (a K_* constant)
# and modifier is a flag combining some of the MOD_* constant (to test the presence