mirror of
https://forge.apps.education.fr/phroy/frankie-on-platform.git
synced 2024-01-27 11:32:04 +01:00
Mouvement par module Python suite
This commit is contained in:
parent
263b47d3ea
commit
8eb468e390
BIN
fop-05.blend
BIN
fop-05.blend
Binary file not shown.
51
fop.py
51
fop.py
@ -51,13 +51,13 @@ def clavier(cont):
|
|||||||
obj['chute']=0
|
obj['chute']=0
|
||||||
if obj['courrir']<40: # 40 : nombre de pas pour courrir
|
if obj['courrir']<40: # 40 : nombre de pas pour courrir
|
||||||
obj.applyMovement((0,-pas_lineaire,0), True)
|
obj.applyMovement((0,-pas_lineaire,0), True)
|
||||||
start, end, speed, = 1, 18, 2
|
start, end, speed, layer = 1, 18, 2, 0
|
||||||
obj_rig.playAction('Frankie-avancer', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-avancer', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
obj['courrir']+=1
|
obj['courrir']+=1
|
||||||
else:
|
else:
|
||||||
obj.applyMovement((0,-pas_courrir,0), True)
|
obj.applyMovement((0,-pas_courrir,0), True)
|
||||||
start, end, speed, = 1, 18, 2
|
start, end, speed, layer = 1, 18, 2, 0
|
||||||
obj_rig.playAction('Frankie-courrir', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-courrir', start, end, layer, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
if keyboard.inputs[bge.events.UPARROWKEY].status[0] != ACTIVATE and obj['courrir']>0:
|
if keyboard.inputs[bge.events.UPARROWKEY].status[0] != ACTIVATE and obj['courrir']>0:
|
||||||
obj['courrir']=0
|
obj['courrir']=0
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ def clavier(cont):
|
|||||||
idle=False
|
idle=False
|
||||||
obj['chute']=0
|
obj['chute']=0
|
||||||
obj.applyMovement((0,pas_lineaire,0), True)
|
obj.applyMovement((0,pas_lineaire,0), True)
|
||||||
start, end, speed, = 1, 20, 2
|
start, end, speed, layer = 1, 20, 2, 0
|
||||||
obj_rig.playAction('Frankie-reculer', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-reculer', start, end, layer, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
|
|
||||||
# Tourner gauche : Flèche gauche - Left arrow
|
# Tourner gauche : Flèche gauche - Left arrow
|
||||||
if keyboard.inputs[bge.events.LEFTARROWKEY].status[0] == ACTIVATE:
|
if keyboard.inputs[bge.events.LEFTARROWKEY].status[0] == ACTIVATE:
|
||||||
@ -77,19 +77,9 @@ def clavier(cont):
|
|||||||
obj.applyRotation((0, 0,pas_angulaire_fps), True)
|
obj.applyRotation((0, 0,pas_angulaire_fps), True)
|
||||||
else:
|
else:
|
||||||
obj.applyRotation((0, 0,pas_angulaire), True)
|
obj.applyRotation((0, 0,pas_angulaire), True)
|
||||||
start, end, speed, = 1, 12, 2
|
start, end, speed, layer = 1, 12, 2, 0
|
||||||
obj_rig.playAction('Frankie-gauche', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-gauche', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
|
|
||||||
# start = 1
|
|
||||||
# end = 100
|
|
||||||
# layer = 0
|
|
||||||
# priority = 1
|
|
||||||
# blendin = 1.0
|
|
||||||
# mode = bge.logic.KX_ACTION_MODE_PLAY
|
|
||||||
# layerWeight = 0.0
|
|
||||||
# ipoFlags = 0
|
|
||||||
# speed = scene.objects['Commands']['speed']*8
|
|
||||||
|
|
||||||
# Tourner droite : Flèche droit - Right arrow
|
# Tourner droite : Flèche droit - Right arrow
|
||||||
if keyboard.inputs[bge.events.RIGHTARROWKEY].status[0] == ACTIVATE:
|
if keyboard.inputs[bge.events.RIGHTARROWKEY].status[0] == ACTIVATE:
|
||||||
idle=False
|
idle=False
|
||||||
@ -98,8 +88,8 @@ def clavier(cont):
|
|||||||
obj.applyRotation((0, 0,-pas_angulaire_fps), True)
|
obj.applyRotation((0, 0,-pas_angulaire_fps), True)
|
||||||
else:
|
else:
|
||||||
obj.applyRotation((0, 0,-pas_angulaire), True)
|
obj.applyRotation((0, 0,-pas_angulaire), True)
|
||||||
start, end, speed, = 1, 12, 2
|
start, end, speed, layer = 1, 12, 2, 0
|
||||||
obj_rig.playAction('Frankie-droite', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-droite', start, end, layer, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
|
|
||||||
# Saut
|
# Saut
|
||||||
# obj['dist_terrain']= obj.getDistanceTo(scene.objects['Terrain'])
|
# obj['dist_terrain']= obj.getDistanceTo(scene.objects['Terrain'])
|
||||||
@ -117,14 +107,15 @@ def clavier(cont):
|
|||||||
# obj_rig.playAction('Frankie-sauter', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
# obj_rig.playAction('Frankie-sauter', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
objs_sol=('Terrain', 'Platforme', 'Pont 1', 'Pont 2')
|
objs_sol=('Terrain', 'Platforme', 'Pont 1', 'Pont 2')
|
||||||
for obj_sol in objs_sol:
|
for obj_sol in objs_sol:
|
||||||
# print (obj.collide(scene.objects[obj_sol]))
|
|
||||||
if obj.collide(scene.objects[obj_sol])[0]:
|
if obj.collide(scene.objects[obj_sol])[0]:
|
||||||
if len(obj.collide(scene.objects[obj_sol])[1])>0:
|
if len(obj.collide(scene.objects[obj_sol])[1])>0:
|
||||||
obj.applyForce((0, 0,force_saut), True)
|
obj.applyForce((0, 0,force_saut), True)
|
||||||
start, end, speed, = 1, 34, 2
|
start, end, speed, layer = 1, 34, 2, 1
|
||||||
obj_rig.playAction('Frankie-sauter', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-sauter', start, end, layer, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
print (obj_rig.isPlayingAction(1))
|
||||||
|
|
||||||
# Chute
|
# Chute
|
||||||
if obj.worldPosition.z == obj['chute_z']:
|
if obj.worldPosition.z == obj['chute_z']:
|
||||||
obj['chute']=0
|
obj['chute']=0
|
||||||
@ -132,7 +123,7 @@ def clavier(cont):
|
|||||||
obj['chute']+=1
|
obj['chute']+=1
|
||||||
objs_sol=('Terrain', 'Platforme', 'Pont 1', 'Pont 2')
|
objs_sol=('Terrain', 'Platforme', 'Pont 1', 'Pont 2')
|
||||||
for obj_sol in objs_sol:
|
for obj_sol in objs_sol:
|
||||||
print (obj.collide(scene.objects[obj_sol]))
|
# print (obj.collide(scene.objects[obj_sol]))
|
||||||
if obj.collide(scene.objects[obj_sol])[0]:
|
if obj.collide(scene.objects[obj_sol])[0]:
|
||||||
if len(obj.collide(scene.objects[obj_sol])[1])>0:
|
if len(obj.collide(scene.objects[obj_sol])[1])>0:
|
||||||
obj['chute']=0
|
obj['chute']=0
|
||||||
@ -149,13 +140,13 @@ def clavier(cont):
|
|||||||
obj['chute_z'] = obj.worldPosition.z
|
obj['chute_z'] = obj.worldPosition.z
|
||||||
if obj['chute']>50:
|
if obj['chute']>50:
|
||||||
idle=False
|
idle=False
|
||||||
start, end, speed, = 1, 33, 2
|
start, end, speed, layer = 1, 33, 2, 0
|
||||||
obj_rig.playAction('Frankie-tomber', start, end, 0, 1, 1.0, LOOP, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-tomber', start, end, layer, 1, 1.0, LOOP, 0.0, 0, speed)
|
||||||
|
|
||||||
# Attente
|
# Attente
|
||||||
if idle:
|
if idle:
|
||||||
start, end, speed, = 1, 268, 2
|
start, end, speed, layer = 1, 268, 2, 0
|
||||||
obj_rig.playAction('Frankie-attente', start, end, 0, 1, 1.0, LOOP, 0.0, 0, speed)
|
obj_rig.playAction('Frankie-attente', start, end, layer, 1, 1.0, LOOP, 0.0, 0, speed)
|
||||||
|
|
||||||
# Caméra FPS
|
# Caméra FPS
|
||||||
if JUST_ACTIVATED in keyboard.inputs[bge.events.FKEY].queue:
|
if JUST_ACTIVATED in keyboard.inputs[bge.events.FKEY].queue:
|
||||||
@ -233,8 +224,8 @@ def init(cont):
|
|||||||
scene.objects['Pancarte '+str(i)].setVisible(False,True)
|
scene.objects['Pancarte '+str(i)].setVisible(False,True)
|
||||||
|
|
||||||
# Mise en route de la plateforme
|
# Mise en route de la plateforme
|
||||||
start, end, speed, = 1, 200, 0.5
|
start, end, speed, layer = 1, 200, 0.5, 0
|
||||||
scene.objects['Platforme'].playAction('Platforme-action', start, end, 0, 1, 1.0, LOOP, 0.0, 0, speed)
|
scene.objects['Platforme'].playAction('Platforme-action', start, end, layer, 1, 1.0, LOOP, 0.0, 0, speed)
|
||||||
|
|
||||||
# Chute
|
# Chute
|
||||||
def chute(cont):
|
def chute(cont):
|
||||||
@ -263,8 +254,8 @@ def ressort(cont):
|
|||||||
obj_ressort=scene.objects[obj.name[:-7]]
|
obj_ressort=scene.objects[obj.name[:-7]]
|
||||||
obj_frankie = scene.objects['Frankie']
|
obj_frankie = scene.objects['Frankie']
|
||||||
if sensor.positive:
|
if sensor.positive:
|
||||||
start, end, speed, = 1, 16, 0.5
|
start, end, speed, layer = 1, 16, 0.5, 0
|
||||||
obj_ressort.playAction(obj_ressort.name+'-action', start, end, 0, 1, 1.0, PLAY, 0.0, 0, speed)
|
obj_ressort.playAction(obj_ressort.name+'-action', start, end, layer, 1, 1.0, PLAY, 0.0, 0, speed)
|
||||||
obj_frankie.applyForce((0, 0,force_saut), True)
|
obj_frankie.applyForce((0, 0,force_saut), True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user