Ajout des ressorts
This commit is contained in:
parent
24310fda4c
commit
ec9c006599
Binary file not shown.
Binary file not shown.
32
fop.py
32
fop.py
|
@ -99,17 +99,18 @@ def clavier(cont):
|
||||||
# Saut sur les téléporte (mode debug) : avancer
|
# Saut sur les téléporte (mode debug) : avancer
|
||||||
if JUST_ACTIVATED in keyboard.inputs[bge.events.ZKEY].queue and obj['spawn']<8:
|
if JUST_ACTIVATED in keyboard.inputs[bge.events.ZKEY].queue and obj['spawn']<8:
|
||||||
obj['spawn'] +=1
|
obj['spawn'] +=1
|
||||||
print ("Saut sur les téléporte :", obj['spawn'])
|
|
||||||
obj_spawn = scene.objects['Spawn '+str(obj['spawn'])]
|
obj_spawn = scene.objects['Spawn '+str(obj['spawn'])]
|
||||||
|
print (obj_spawn['sens'])
|
||||||
obj.worldPosition = obj_spawn.worldPosition
|
obj.worldPosition = obj_spawn.worldPosition
|
||||||
obj.applyRotation((0, 0, -obj.worldOrientation.to_euler().z+math.pi), False)
|
obj.applyRotation((0, 0, -obj.worldOrientation.to_euler().z+obj_spawn['sens']), False)
|
||||||
|
|
||||||
# Saut sur les téléporte (mode debug) : reculer
|
# Saut sur les téléportes(mode debug) : reculer
|
||||||
if JUST_ACTIVATED in keyboard.inputs[bge.events.AKEY].queue and obj['spawn']>0:
|
if JUST_ACTIVATED in keyboard.inputs[bge.events.AKEY].queue and obj['spawn']>0:
|
||||||
obj['spawn'] -=1
|
obj['spawn'] -=1
|
||||||
print ("Saut sur les téléporte :", obj['spawn'])
|
|
||||||
obj_spawn = scene.objects['Spawn '+str(obj['spawn'])]
|
obj_spawn = scene.objects['Spawn '+str(obj['spawn'])]
|
||||||
|
print (obj_spawn['sens'])
|
||||||
obj.worldPosition = obj_spawn.worldPosition
|
obj.worldPosition = obj_spawn.worldPosition
|
||||||
|
obj.applyRotation((0, 0, -obj.worldOrientation.to_euler().z+obj_spawn['sens']), False)
|
||||||
|
|
||||||
###
|
###
|
||||||
# Suivi par la caméra
|
# Suivi par la caméra
|
||||||
|
@ -144,6 +145,13 @@ def init(cont):
|
||||||
for i in range (1, 7):
|
for i in range (1, 7):
|
||||||
scene.objects['Pancarte '+str(i)].setVisible(False,True)
|
scene.objects['Pancarte '+str(i)].setVisible(False,True)
|
||||||
|
|
||||||
|
# Animation plateforme
|
||||||
|
start = 1
|
||||||
|
end = 200
|
||||||
|
mode = bge.logic.KX_ACTION_MODE_LOOP
|
||||||
|
speed = 0.5
|
||||||
|
scene.objects['Platforme'].playAction('Platforme-action', start, end, 0, 1, 1.0, mode, 0.0, 0, speed)
|
||||||
|
|
||||||
# Chute
|
# Chute
|
||||||
def chute(cont):
|
def chute(cont):
|
||||||
obj = cont.owner
|
obj = cont.owner
|
||||||
|
@ -161,6 +169,22 @@ def checkpoint(cont):
|
||||||
obj_frankie['spawn']=obj_i
|
obj_frankie['spawn']=obj_i
|
||||||
scene.objects['Pancarte '+str(obj_i)].setVisible(True,True)
|
scene.objects['Pancarte '+str(obj_i)].setVisible(True,True)
|
||||||
|
|
||||||
|
# Ressort
|
||||||
|
def ressort(cont):
|
||||||
|
obj = cont.owner
|
||||||
|
sensor = obj.sensors['Collision']
|
||||||
|
force_saut = 1000
|
||||||
|
obj_ressort=scene.objects[obj.name[:-7]]
|
||||||
|
obj_frankie = scene.objects['Frankie']
|
||||||
|
if sensor.positive:
|
||||||
|
start = 1,
|
||||||
|
end = 16,
|
||||||
|
mode = bge.logic.KX_ACTION_MODE_PLAY,
|
||||||
|
speed = 0.5
|
||||||
|
obj_ressort.playAction(obj_ressort.name+'-action', start, end, 0, 1, 1.0, mode, 0.0, 0, speed)
|
||||||
|
obj_frankie.applyForce((0, 0,force_saut), True)
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Gestion du Joystick (Joystick USB)
|
# Gestion du Joystick (Joystick USB)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
Loading…
Reference in New Issue