mirror of
https://forge.apps.education.fr/phroy/codetower.git
synced 2024-01-27 11:35:17 +01:00
Readme update
This commit is contained in:
parent
70c49c0ae8
commit
9915374674
Binary file not shown.
20
ct.py
20
ct.py
@ -467,12 +467,15 @@ def terrain_speed (obj):
|
||||
# Page de fin
|
||||
def endbanner_hl(cont):
|
||||
if cont.sensors['MO'].status == JUST_ACTIVATED:
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
mouse_up()
|
||||
scene.objects['Endbanner'].color = color_white
|
||||
scene.objects['Endbanner_wave'].color = color_white
|
||||
scene.objects['Endbanner_points'].color = color_white
|
||||
scene.objects['Endbanner_ok'].color = color_white
|
||||
if cont.sensors['MO'].status == JUST_RELEASED:
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
mouse_down()
|
||||
scene.objects['Endbanner'].color = color_endbanner_bluelight
|
||||
scene.objects['Endbanner_wave'].color = color_black
|
||||
scene.objects['Endbanner_points'].color = color_black
|
||||
@ -516,6 +519,7 @@ def cmd_init():
|
||||
|
||||
# UI : Mouse
|
||||
# Window size : 738.5 415.5
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2))
|
||||
bge.render.showMouse(scene.objects['Commands']['debug_mouse'])
|
||||
scene.objects['Mouse_main'].worldPosition = [0.07, -8.11, 4.71035] # Vielle version : [0.118161, -8.24305, 4.71035] ; [0, -3.5, 2], [0, -8, 6]
|
||||
@ -523,6 +527,9 @@ def cmd_init():
|
||||
scene.objects['Mouse_main']['past_x']=0
|
||||
scene.objects['Mouse_main']['past_y']=0
|
||||
scene.objects['Mouse_main']['mouse_up']=0
|
||||
else:
|
||||
scene.objects['Mouse_main'].setVisible(False,False)
|
||||
bge.render.showMouse(True)
|
||||
|
||||
# scene.objects['Raz-vue-Hl'].setVisible(False,False)
|
||||
# scene.objects['Aide-cmd-Hl'].setVisible(False,False)
|
||||
@ -645,6 +652,7 @@ def mode(cont):
|
||||
scene.objects['Camera'].worldPosition.z = scene.objects['Camera']['init_lz']
|
||||
applyRotationTo(scene.objects['Terrain'], 0, 0, 0)
|
||||
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2))
|
||||
scene.objects['Mouse_main'].worldPosition = [0.07, -8.11, 4.71035] # Vielle version : [0.118161, -8.24305, 4.71035] ; [0, -3.5, 2], [0, -8, 6]
|
||||
scene.objects['Mouse_main'].worldScale=[30, 30, 30]
|
||||
@ -748,10 +756,12 @@ def manip(cont):
|
||||
# Pan
|
||||
if obj['manip_mode']==1: # Shift
|
||||
scene.objects['Camera'].applyMovement((delta_x*-sensibilite_pan, delta_y*sensibilite_pan, 0), True)
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
scene.objects['Mouse_main'].applyMovement((delta_x*-sensibilite_pan, delta_y*sensibilite_pan, 0), True)
|
||||
|
||||
# Zoom FIXME : marche pas au niveau de la souris
|
||||
if obj['manip_mode']==2: # Ctrl
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
position_scale_x = 0.0005
|
||||
position_scale_y = position_scale_x
|
||||
mouse_x=scene.objects['Mouse_main'].sensors["Mouse"].position[0]-int(bge.render.getWindowWidth() / 2)
|
||||
@ -760,6 +770,7 @@ def manip(cont):
|
||||
distance_cam = math.sqrt((scene.objects['Camera'].worldPosition.y**2+scene.objects['Camera'].worldPosition.z**2))
|
||||
size_scale = (distance_cam/distance_cam_past) * 0.23
|
||||
scene.objects['Camera'].applyMovement((0, 0, (delta_x+delta_y)*sensibilite_zoom), True)
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
scene.objects['Mouse_main'].applyMovement((mouse_x*(delta_x+delta_y)*sensibilite_zoom*position_scale_x, -mouse_y*(delta_x+delta_y)*sensibilite_zoom*position_scale_y, 0), True)
|
||||
scene.objects['Mouse_main'].worldScale *= (delta_x+delta_y)*sensibilite_zoom*size_scale
|
||||
scene.objects['Camera']['past_ly']=scene.objects['Camera'].worldPosition.y
|
||||
@ -771,6 +782,7 @@ def manip_wheel(cont):
|
||||
if scene.objects['Terrain']['manip_mode']!=9: # Fenêtre modale
|
||||
obj = cont.owner
|
||||
sensibilite_wheel = 5 # Base : 20
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
position_scale_x = 0.0005
|
||||
position_scale_y = position_scale_x
|
||||
mouse_x=scene.objects['Mouse_main'].sensors["Mouse"].position[0]-int(bge.render.getWindowWidth() / 2)
|
||||
@ -781,11 +793,13 @@ def manip_wheel(cont):
|
||||
# size_scale = 0.23
|
||||
if cont.sensors['WheelUp'].positive:
|
||||
scene.objects['Camera'].applyMovement((0, 0, -sensibilite_wheel), True)
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
distance_cam = math.sqrt((scene.objects['Camera'].worldPosition.y**2+scene.objects['Camera'].worldPosition.z**2))
|
||||
scene.objects['Mouse_main'].applyMovement((-mouse_x*sensibilite_wheel*position_scale_x, mouse_y*sensibilite_wheel*position_scale_y, 0), True)
|
||||
scene.objects['Mouse_main'].worldScale *= sensibilite_wheel* (distance_cam/distance_cam_past) *size_scale
|
||||
elif cont.sensors['WheelDown'].positive:
|
||||
scene.objects['Camera'].applyMovement((0, 0, sensibilite_wheel), True)
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
distance_cam = math.sqrt((scene.objects['Camera'].worldPosition.y**2+scene.objects['Camera'].worldPosition.z**2))
|
||||
scene.objects['Mouse_main'].applyMovement((mouse_x*sensibilite_wheel*position_scale_x, -mouse_y*sensibilite_wheel*position_scale_y, 0), True)
|
||||
scene.objects['Mouse_main'].worldScale /= sensibilite_wheel* (distance_cam_past/distance_cam) *size_scale
|
||||
@ -794,6 +808,8 @@ def manip_wheel(cont):
|
||||
|
||||
# Icone de la souris
|
||||
def mouse(cont):
|
||||
if scene.objects['Mouse_main']['mouse_graphic']==False:
|
||||
return
|
||||
obj = cont.owner
|
||||
|
||||
# Ancienne version basée sur la position de la caméra
|
||||
@ -896,6 +912,7 @@ def about_hl(cont):
|
||||
# decal = 18
|
||||
# size_scale = 0.2
|
||||
if cont.sensors['MO'].status == JUST_ACTIVATED:
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
mouse_up()
|
||||
# # print (scene.objects['Mouse_main'].getVectTo(scene.objects['Camera'])[1])
|
||||
# vect=scene.objects['Mouse_main'].getVectTo(scene.objects['Camera'])[1]
|
||||
@ -911,6 +928,7 @@ def about_hl(cont):
|
||||
|
||||
if cont.sensors['MO'].status == JUST_RELEASED:
|
||||
# print("about_hl R avant", scene.objects['Mouse_main'].worldPosition)
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
mouse_down()
|
||||
# print (scene.objects['Mouse_main'].getVectTo(scene.objects['Camera'])[1])
|
||||
# vect=scene.objects['Mouse_main'].getVectTo(scene.objects['Camera'])[1]
|
||||
@ -958,10 +976,12 @@ def about_link_hl(cont):
|
||||
obj = cont.owner
|
||||
name=obj.name[:-7]
|
||||
scene.objects[name].color = color_link_hl
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
mouse_up()
|
||||
|
||||
if cont.sensors['MO'].status == JUST_RELEASED :
|
||||
obj = cont.owner
|
||||
name=obj.name[:-7]
|
||||
scene.objects[name].color = color_link
|
||||
if scene.objects['Mouse_main']['mouse_graphic']:
|
||||
mouse_down()
|
||||
|
Loading…
Reference in New Issue
Block a user