mirror of
https://forge.apps.education.fr/blender-edutech/blender-edutech-tutoriels.git
synced 2024-01-27 09:42:33 +01:00
Tutoriel 2 : début
This commit is contained in:
parent
481c53194d
commit
684f54a0bd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@ import bge # Bibliothèque Blender Game Engine (BGE)
|
||||
# @project: Blender-EduTech
|
||||
# @lang: fr
|
||||
# @authors: Philippe Roy <philippe.roy@ac-grenoble.fr>
|
||||
# @copyright: Copyright (C) 2021 Philippe Roy
|
||||
# @copyright: Copyright (C) 2023 Philippe Roy
|
||||
# @license: GNU GPL
|
||||
#
|
||||
# Commandes déclenchées par UPBGE pour le tutoriel Labyrinthe
|
||||
@ -28,26 +28,43 @@ ACTIVATE = bge.logic.KX_INPUT_ACTIVE
|
||||
# Gestion du clavier
|
||||
###############################################################################
|
||||
|
||||
# Initialisation
|
||||
def init(cont):
|
||||
|
||||
# Mémorisation de la position de départ du joueur
|
||||
obj = scene.objects['Bille']
|
||||
# obj = cont.owner
|
||||
obj['init_lx']=obj.worldPosition.x
|
||||
obj['init_ly']=obj.worldPosition.y
|
||||
obj['init_lz']=obj.worldPosition.z
|
||||
|
||||
# Cacher la panneau de la victoire
|
||||
scene.objects['Panneau victoire'].setVisible(False,True)
|
||||
|
||||
###############################################################################
|
||||
# Gestion du clavier
|
||||
###############################################################################
|
||||
|
||||
# Flèches pour tourner le plateau
|
||||
def clavier(cont):
|
||||
# obj = cont.owner
|
||||
obj = cont.owner
|
||||
obj = scene.objects['Plateau']
|
||||
keyboard = bge.logic.keyboard
|
||||
resolution = 0.01
|
||||
|
||||
# Up
|
||||
# Flèche haut - Up arrow
|
||||
if (ACTIVATE == keyboard.events[bge.events.UPARROWKEY]):
|
||||
obj.applyRotation((-resolution,0,0), False)
|
||||
|
||||
# Down
|
||||
# Flèche bas - Down arrow
|
||||
if (ACTIVATE == keyboard.events[bge.events.DOWNARROWKEY]):
|
||||
obj.applyRotation((resolution,0,0), False)
|
||||
|
||||
# Left
|
||||
# Flèche gauche - Left arrow
|
||||
if (ACTIVATE == keyboard.events[bge.events.LEFTARROWKEY]):
|
||||
obj.applyRotation((0, -resolution,0), False)
|
||||
|
||||
# Right
|
||||
# Flèche droit - Right arrow
|
||||
if (ACTIVATE == keyboard.events[bge.events.RIGHTARROWKEY]):
|
||||
obj.applyRotation((0, resolution,0), False)
|
||||
|
||||
@ -92,25 +109,6 @@ def joystick(cont):
|
||||
# Restart
|
||||
###############################################################################
|
||||
|
||||
# Initialisation
|
||||
def init(cont):
|
||||
|
||||
# Mémorisation de la position de départ du joueur
|
||||
obj = scene.objects['Joueur']
|
||||
# obj = cont.owner
|
||||
obj['init_lx']=obj.worldPosition.x
|
||||
obj['init_ly']=obj.worldPosition.y
|
||||
obj['init_lz']=obj.worldPosition.z
|
||||
|
||||
# Cacher le texte de victoire
|
||||
scene.objects['Texte'].setVisible(False,False)
|
||||
|
||||
# Appliquer le poids à la balle
|
||||
# obj.gravity = [0, 0, -10000000]
|
||||
# obj.mass = 10
|
||||
# obj. applyForce([0, 0, -100000000])
|
||||
# obj.setDamping(0.5, 0.5)
|
||||
|
||||
# Atteindre une orientation (bas niveau)
|
||||
def applyRotationTo(obj, rx=None, ry=None, rz=None):
|
||||
rres=0.001 # resolution rotation
|
||||
@ -161,8 +159,8 @@ def restart(cont):
|
||||
obj.worldPosition.z=obj['init_lz']
|
||||
|
||||
###############################################################################
|
||||
# Gagné
|
||||
# Victoire
|
||||
###############################################################################
|
||||
|
||||
def gagne(cont):
|
||||
scene.objects['Texte'].setVisible(True,False)
|
||||
scene.objects['Panneau victoire'].setVisible(True,False)
|
||||
|
Loading…
Reference in New Issue
Block a user