show menu after key <menu> pressed (default Escape)

This commit is contained in:
AleaJactaEst 2021-09-23 00:50:40 +02:00
parent 1d9ec43b34
commit 388d1a5391
7 changed files with 71 additions and 9 deletions

View file

@ -34,3 +34,6 @@
9) A l'ouverture du JukeBox, il retaille la fenetre afin de ne pas avoir du scrolling (si possible) 9) A l'ouverture du JukeBox, il retaille la fenetre afin de ne pas avoir du scrolling (si possible)
10) Ajout d'une scene simple (damier + personnage avec annimation, et ajout d'autre créature)
11) Ajout du menu (quand on presse Escape) pendant la scene pour voir les options/quitter/...

View file

@ -1,4 +1,39 @@
VERSION GODOT : 3.3.3 # Khanat
https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_x11.64.zip
## Launch Game
### Download Version Godot
We use version GODOT : 3.3.3
wget https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_x11.64.zip
### Clone our project
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/khanat-client.git
### Launch Godot
godot khanat-client
## Add/update your language
Welcome to help us to improve our translation.
We need clone our project.
### Create a new language
* On Linux :
Edit file : khanat-client/locale/locale.sh
(You need add in section [# LIST LANGUAGE] your locale)
After launch this script : bash khanat-client/locale/locale.sh
### Edit your local
khanat-client/locale/<your locale].po
### Push your update
To send your update, could you please create a branch and send us this branch?

View file

@ -70,10 +70,18 @@ func _ready():
self.add_creature("RA_3", "res://scenes/player/creature_raference.tscn", Vector3( 1.0, 0.01, 5.0 ), Vector3( 0.0, -3.141592, 0.0 )) self.add_creature("RA_3", "res://scenes/player/creature_raference.tscn", Vector3( 1.0, 0.01, 5.0 ), Vector3( 0.0, -3.141592, 0.0 ))
self.add_creature("Arche_1", "res://scenes/player/creature_arche.tscn", Vector3( -2.0, 0.01, 2.0 ), Vector3( 0.0, -3.141592, 0.0 )) self.add_creature("Arche_1", "res://scenes/player/creature_arche.tscn", Vector3( -2.0, 0.01, 2.0 ), Vector3( 0.0, -3.141592, 0.0 ))
self.add_creature("Isidor_1", "res://scenes/player/creature_isidor.tscn", Vector3( -2.0, 0.01, 5.0 ), Vector3( 0.0, -3.141592, 0.0 )) self.add_creature("Isidor_1", "res://scenes/player/creature_isidor.tscn", Vector3( -2.0, 0.01, 5.0 ), Vector3( 0.0, -3.141592, 0.0 ))
pass # Replace with function body. $player.connect("menu_options_pressed", self, "_on_menu_options")
func _on_menu_options():
Config.msg_info("Received menu options")
if $menu_options.is_visible():
$menu_options.hide()
else:
$menu_options.show()
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
Config.msg_info("update Map") #Config.msg_info("update Map")
pass pass

View file

@ -1,5 +1,6 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/interfaces/menu_options/menu_options.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/game/alpha.gd" type="Script" id=5] [ext_resource path="res://scenes/game/alpha.gd" type="Script" id=5]
[ext_resource path="res://scenes/player/playerB.tscn" type="PackedScene" id=8] [ext_resource path="res://scenes/player/playerB.tscn" type="PackedScene" id=8]
@ -12,3 +13,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0 )
[node name="map" type="Spatial" parent="."] [node name="map" type="Spatial" parent="."]
[node name="creatures" type="Spatial" parent="."] [node name="creatures" type="Spatial" parent="."]
[node name="menu_options" parent="." instance=ExtResource( 1 )]
visible = false

View file

@ -63,6 +63,11 @@ func connect_ext( signal_name, target ):
target.connect( signal_name, self, "_on_signal_" + signal_name ) target.connect( signal_name, self, "_on_signal_" + signal_name )
func connect_ext_func( signal_name, target , function_target):
Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + "_on_signal_" + signal_name + "]")
target.connect( signal_name, self, function_target )
func _on_stream_finished(): func _on_stream_finished():
# When finished playing a stream, make the player available again. # When finished playing a stream, make the player available again.
Config.msg_debug("_on_stream_finished") Config.msg_debug("_on_stream_finished")

View file

@ -88,6 +88,11 @@ func connect_ext( signal_name, target):
target.connect( signal_name, self, "_on_signal_" + signal_name ) target.connect( signal_name, self, "_on_signal_" + signal_name )
func connect_ext_func( signal_name, target , function_target):
Config.msg_debug("Connect external [signal:" + signal_name + ", func:" + "_on_signal_" + signal_name + "]")
target.connect( signal_name, self, function_target )
func update_mute(): func update_mute():
Config.msg_debug("") Config.msg_debug("")
$window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute $window_dialog/margin_container/v_box_container/tab_container/OPTION_SETTINGS_SOUND/h_box_container_2/mute.pressed = Config.mute

View file

@ -1,5 +1,7 @@
extends Spatial extends Spatial
signal menu_options_pressed
var animation_object:AnimationPlayer = null var animation_object:AnimationPlayer = null
var rotation_speed_factor = 0.01 var rotation_speed_factor = 0.01
var orientation = 0.0 var orientation = 0.0
@ -138,11 +140,9 @@ func _process( delta ):
# Movement # Movement
velocity = self.calculate_velocity(velocity, move_direction, delta) velocity = self.calculate_velocity(velocity, move_direction, delta)
# Config.msg_info("move_direction X:" + str(move_direction.x) + " Y:" + str(move_direction.y) + " Z:" + str(move_direction.z))
# Config.msg_info("velocity X:" + str(velocity.x) + " Y:" + str(velocity.y) + " Z:" + str(velocity.z))
velocity = $creature.move_and_slide(velocity, Vector3.UP, true) velocity = $creature.move_and_slide(velocity, Vector3.UP, true)
var pos : Vector3 = $creature.get_global_transform().origin var pos : Vector3 = $creature.get_global_transform().origin
Config.msg_info("pos X:" + str(pos.x) + " Y:" + str(pos.y) + " Z:" + str(pos.z) + " run:" + str(Input.get_action_strength("move_run")) + str(Input.get_action_strength("move_toggle_run")) ) #Config.msg_info("pos X:" + str(pos.x) + " Y:" + str(pos.y) + " Z:" + str(pos.z) + " run:" + str(Input.get_action_strength("move_run")) + str(Input.get_action_strength("move_toggle_run")) )
if input_direction: if input_direction:
if not input_direction.z == 0.0: if not input_direction.z == 0.0:
if input_direction.z < 0.0: if input_direction.z < 0.0:
@ -209,4 +209,6 @@ func _input( event ):
else: else:
$creature/camera_tps.make_current() $creature/camera_tps.make_current()
elif event.is_action_pressed("menu"): elif event.is_action_pressed("menu"):
get_tree().quit() #get_tree().quit()
Config.msg_info("Received menu options")
emit_signal("menu_options_pressed")