Implement save and loading games (#8)
This commit is contained in:
@@ -9,191 +9,191 @@
|
||||
[ext_resource path="res://game/characters/mark/png/mark_talk_right.png" type="Texture" id=7]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 48, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 5 )
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 5 )
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 5 )
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 48, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 96, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=6]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 72, 0, 24, 70 )
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=7]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 216, 0, 24, 70 )
|
||||
atlas = ExtResource( 5 )
|
||||
region = Rect2( 48, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=8]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 240, 0, 24, 70 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=9]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 264, 0, 24, 70 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=10]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 288, 0, 24, 70 )
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=11]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 312, 0, 24, 70 )
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=12]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
region = Rect2( 48, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=13]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
region = Rect2( 72, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=14]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 48, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=15]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 72, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=16]
|
||||
atlas = ExtResource( 7 )
|
||||
region = Rect2( 96, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=17]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=18]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 120, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=19]
|
||||
[sub_resource type="AtlasTexture" id=15]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 144, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=20]
|
||||
[sub_resource type="AtlasTexture" id=16]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 168, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=21]
|
||||
[sub_resource type="AtlasTexture" id=17]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 192, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=22]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=23]
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=24]
|
||||
atlas = ExtResource( 2 )
|
||||
[sub_resource type="AtlasTexture" id=18]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 48, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=19]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 120, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=20]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 216, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=21]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 240, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=22]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 264, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=23]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 288, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=24]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 312, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=25]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 72, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=26]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=27]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=28]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 336, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=29]
|
||||
[sub_resource type="AtlasTexture" id=27]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 360, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=30]
|
||||
[sub_resource type="AtlasTexture" id=28]
|
||||
atlas = ExtResource( 4 )
|
||||
region = Rect2( 384, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=29]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 0, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=30]
|
||||
atlas = ExtResource( 6 )
|
||||
region = Rect2( 24, 0, 24, 70 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=31]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 1 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_down_right",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 5 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 6 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ) ],
|
||||
"loop": true,
|
||||
"name": "walk_right",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 17 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 18 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_down_left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 19 ), SubResource( 20 ), SubResource( 21 ), SubResource( 20 ) ],
|
||||
"loop": true,
|
||||
"name": "walk_down",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 22 ), SubResource( 23 ), SubResource( 24 ), SubResource( 23 ), SubResource( 24 ) ],
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 2 ), SubResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_down",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 25 ), SubResource( 26 ), SubResource( 26 ) ],
|
||||
"frames": [ SubResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_up",
|
||||
"speed": 3.0
|
||||
"name": "idle_left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 27 ) ],
|
||||
"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_down_right",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 8 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_down_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 28 ), SubResource( 29 ), SubResource( 30 ), SubResource( 29 ) ],
|
||||
"frames": [ SubResource( 9 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_down",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 16 ) ],
|
||||
"loop": true,
|
||||
"name": "walk_down",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 18 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_right",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 19 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_down_left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 20 ), SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ],
|
||||
"loop": true,
|
||||
"name": "walk_right",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 25 ) ],
|
||||
"loop": true,
|
||||
"name": "idle_up",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 26 ), SubResource( 27 ), SubResource( 28 ), SubResource( 27 ) ],
|
||||
"loop": true,
|
||||
"name": "walk_up",
|
||||
"speed": 6.0
|
||||
}, {
|
||||
"frames": [ SubResource( 29 ), SubResource( 30 ), SubResource( 29 ), SubResource( 30 ), SubResource( 30 ) ],
|
||||
"loop": true,
|
||||
"name": "speak_up",
|
||||
"speed": 3.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=32]
|
||||
@@ -202,6 +202,7 @@ height = 0.0
|
||||
[node name="mark" type="Area2D"]
|
||||
script = ExtResource( 1 )
|
||||
global_id = "player"
|
||||
is_movable = true
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
animations = ExtResource( 3 )
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ const dir_angles = [
|
||||
]
|
||||
|
||||
# Array of animations for each direction, from UP to RIGHT_UP clockwise
|
||||
# [animation_name, scale] : scale parameter can be set to -1 to mirror the animation
|
||||
# [animation_name, scale]: scale parameter can be set to -1 to mirror the animation
|
||||
const directions = [
|
||||
["walk_up", 1], # 0 UP
|
||||
["walk_up", 1], # 1 RIGHT UP
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#]
|
||||
|
||||
# Angle is [from_angle, area_angle]
|
||||
# example : on a clock, [180, 45] starts exactly from 6 o'clock (180°)
|
||||
# example: on a clock, [180, 45] starts exactly from 6 o'clock (180°)
|
||||
# and stops between 7 o'clock and 8 o'clock (45° from 6 o'clock)
|
||||
const dir_angles = [
|
||||
[340, 40], # 0 UP
|
||||
@@ -24,7 +24,7 @@ const dir_angles = [
|
||||
]
|
||||
|
||||
# Array of animations for each direction, from UP to RIGHT_UP clockwise
|
||||
# [animation_name, scale] : scale parameter can be set to -1 to mirror the animation
|
||||
# [animation_name, scale]: scale parameter can be set to -1 to mirror the animation
|
||||
const directions = [
|
||||
["walk_up", 1], # 0 UP
|
||||
["walk_up", 1], # 1 RIGHT UP
|
||||
|
||||
@@ -39,6 +39,7 @@ say player "Hey!"
|
||||
enable_terrain bridge_open
|
||||
set_global r2_bridge_closed false
|
||||
#set_interactive r2_right_platform true
|
||||
set_interactive r2_bridge false
|
||||
stop
|
||||
> [!r2_bridge_closed]
|
||||
set_state r2_bridge bridge_close
|
||||
|
||||
@@ -16,18 +16,9 @@ player_scene = ExtResource( 4 )
|
||||
camera_limits = [ Rect2( 0, 0, 1289, 555 ) ]
|
||||
|
||||
[node name="walkable_area" parent="." instance=ExtResource( 1 )]
|
||||
scales = null
|
||||
bitmaps_scale = Vector2( 1, 1 )
|
||||
lightmap = null
|
||||
player_speed_multiplier = 1.0
|
||||
player_doubleclick_speed_multiplier = 1.5
|
||||
lightmap_modulate = Color( 1, 1, 1, 1 )
|
||||
debug_mode = 1
|
||||
scale_min = 0.3
|
||||
scale_max = 1.0
|
||||
|
||||
[node name="background" parent="." instance=ExtResource( 2 )]
|
||||
esc_script = ""
|
||||
|
||||
[node name="room_label" type="Label" parent="background"]
|
||||
margin_right = 40.0
|
||||
@@ -44,26 +35,10 @@ __meta__ = {
|
||||
script = ExtResource( 7 )
|
||||
global_id = "r2_right_platform"
|
||||
esc_script = "res://game/rooms/room2/esc/right_platform.esc"
|
||||
is_exit = false
|
||||
is_trigger = false
|
||||
trigger_in_verb = "trigger_in"
|
||||
trigger_out_verb = "trigger_out"
|
||||
is_interactive = true
|
||||
player_orients_on_arrival = true
|
||||
interaction_direction = 3
|
||||
tooltip_name = "Right platform"
|
||||
default_action = "look"
|
||||
combine_if_action_used_among = PoolStringArray( )
|
||||
combine_is_one_way = false
|
||||
use_from_inventory_only = false
|
||||
inventory_item_scene_file = null
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 430.893, 451.052 )
|
||||
}
|
||||
animations = null
|
||||
speed = 300
|
||||
v_speed_damp = 1.0
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_platform"]
|
||||
polygon = PoolVector2Array( 870.974, 538.342, 827.536, 353.995, 1181.4, 357.174, 1287.34, 413.325, 1289.46, 545.758 )
|
||||
@@ -76,25 +51,9 @@ script = ExtResource( 7 )
|
||||
global_id = "r2_r_exit"
|
||||
esc_script = "res://game/rooms/room2/esc/right_exit.esc"
|
||||
is_exit = true
|
||||
is_trigger = false
|
||||
trigger_in_verb = "trigger_in"
|
||||
trigger_out_verb = "trigger_out"
|
||||
is_interactive = true
|
||||
player_orients_on_arrival = true
|
||||
interaction_direction = 0
|
||||
tooltip_name = "Right exit"
|
||||
default_action = "walk"
|
||||
combine_if_action_used_among = PoolStringArray( )
|
||||
combine_is_one_way = false
|
||||
use_from_inventory_only = false
|
||||
inventory_item_scene_file = null
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 1225.47, 353.99 )
|
||||
}
|
||||
animations = null
|
||||
speed = 300
|
||||
v_speed_damp = 1.0
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/r_door"]
|
||||
polygon = PoolVector2Array( 1177.94, 348.61, 1175.95, 45.3759, 1276.06, 92.0953, 1277.95, 399.407 )
|
||||
@@ -107,25 +66,9 @@ script = ExtResource( 7 )
|
||||
global_id = "r2_l_exit"
|
||||
esc_script = "res://game/rooms/room2/esc/left_exit.esc"
|
||||
is_exit = true
|
||||
is_trigger = false
|
||||
trigger_in_verb = "trigger_in"
|
||||
trigger_out_verb = "trigger_out"
|
||||
is_interactive = true
|
||||
player_orients_on_arrival = true
|
||||
interaction_direction = 0
|
||||
tooltip_name = "Left exit"
|
||||
default_action = "walk"
|
||||
combine_if_action_used_among = PoolStringArray( )
|
||||
combine_is_one_way = false
|
||||
use_from_inventory_only = false
|
||||
inventory_item_scene_file = null
|
||||
dialog_color = Color( 1, 1, 1, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 52.1462, 384.691 )
|
||||
}
|
||||
animations = null
|
||||
speed = 300
|
||||
v_speed_damp = 1.0
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Hotspots/l_door"]
|
||||
polygon = PoolVector2Array( -1.37926, 443.158, 7.96461, 122.796, 84.0504, 77.4118, 88.055, 377.751 )
|
||||
@@ -137,24 +80,7 @@ position = Vector2( 52.1462, 384.691 )
|
||||
position = Vector2( 958.107, 176.401 )
|
||||
global_id = "r2_button_right"
|
||||
esc_script = "res://game/rooms/room2/esc/button.esc"
|
||||
is_exit = false
|
||||
is_trigger = false
|
||||
trigger_in_verb = "trigger_in"
|
||||
trigger_out_verb = "trigger_out"
|
||||
is_interactive = true
|
||||
player_orients_on_arrival = true
|
||||
interaction_direction = 0
|
||||
combine_if_action_used_among = PoolStringArray( )
|
||||
combine_is_one_way = false
|
||||
use_from_inventory_only = false
|
||||
inventory_item_scene_file = null
|
||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 987.537, 371.812 )
|
||||
}
|
||||
animations = null
|
||||
speed = 300
|
||||
v_speed_damp = 1.0
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="Hotspots/button_right"]
|
||||
position = Vector2( 29.4302, 195.411 )
|
||||
@@ -166,24 +92,7 @@ __meta__ = {
|
||||
position = Vector2( 288.82, 171.439 )
|
||||
global_id = "r2_button"
|
||||
esc_script = "res://game/rooms/room2/esc/button.esc"
|
||||
is_exit = false
|
||||
is_trigger = false
|
||||
trigger_in_verb = "trigger_in"
|
||||
trigger_out_verb = "trigger_out"
|
||||
is_interactive = true
|
||||
player_orients_on_arrival = true
|
||||
interaction_direction = 0
|
||||
combine_if_action_used_among = PoolStringArray( )
|
||||
combine_is_one_way = false
|
||||
use_from_inventory_only = false
|
||||
inventory_item_scene_file = null
|
||||
dialog_color = Color( 0, 1, 0.109804, 1 )
|
||||
interact_positions = {
|
||||
"default": Vector2( 313.488, 368.437 )
|
||||
}
|
||||
animations = null
|
||||
speed = 300
|
||||
v_speed_damp = 1.0
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="Hotspots/button_left"]
|
||||
position = Vector2( 24.6681, 196.998 )
|
||||
|
||||
@@ -15,6 +15,7 @@ say player "I must USE this."
|
||||
enable_terrain bridge_closed
|
||||
set_global r3_bridge_closed true
|
||||
set_interactive r3_right_platform false
|
||||
set_interactive r3_bridge false
|
||||
stop
|
||||
|
||||
> [!button_broken, r3_bridge_closed]
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
stop
|
||||
|
||||
:ready
|
||||
set_global bridge_closed false
|
||||
set_global r3_bridge_closed false
|
||||
set_state r3_button button_broken
|
||||
set_global button_broken true
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Panel
|
||||
|
||||
var numbers_array : Array
|
||||
var next_to_be_pressed : int = 1
|
||||
var numbers_array: Array
|
||||
var next_to_be_pressed: int = 1
|
||||
|
||||
func _ready():
|
||||
randomize()
|
||||
@@ -32,8 +32,8 @@ func reset():
|
||||
i += 1
|
||||
|
||||
|
||||
func _button_pressed(button : Button):
|
||||
var number : String= button.text
|
||||
func _button_pressed(button: Button):
|
||||
var number: String= button.text
|
||||
if int(number) != next_to_be_pressed:
|
||||
reset()
|
||||
else:
|
||||
|
||||
@@ -8,3 +8,6 @@ OPTIONS_LANGUAGE,Language,Langue
|
||||
GENERAL_VOLUME,General,Général
|
||||
MUSIC_VOLUME,Music,Musique
|
||||
SOUND_VOLUME,Sound effects,Effets sonores
|
||||
CANCEL,Cancel,Annuler
|
||||
OK,OK,OK
|
||||
ENTER_SAVE_NAME,Enter the save name:,Entrez un nom de sauvegarde
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
26
game/ui/commons/load/load_game.gd
Normal file
26
game/ui/commons/load/load_game.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends Control
|
||||
|
||||
signal back_button_pressed
|
||||
|
||||
export(PackedScene) var slot_ui_scene
|
||||
|
||||
func _ready():
|
||||
refresh_savegames()
|
||||
|
||||
func _on_slot_pressed(slot_id: int) -> void:
|
||||
escoria.save_manager.load_game(slot_id)
|
||||
|
||||
func _on_back_pressed():
|
||||
emit_signal("back_button_pressed")
|
||||
|
||||
func refresh_savegames():
|
||||
for slot in $ScrollContainer/slots.get_children():
|
||||
$ScrollContainer/slots.remove_child(slot)
|
||||
|
||||
var saves_list = escoria.save_manager.get_saves_list()
|
||||
for i in saves_list.size():
|
||||
var save_data = saves_list[i+1]
|
||||
var new_slot = slot_ui_scene.instance()
|
||||
$ScrollContainer/slots.add_child(new_slot)
|
||||
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
|
||||
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
|
||||
50
game/ui/commons/load/load_game.tscn
Normal file
50
game/ui/commons/load/load_game.tscn
Normal file
@@ -0,0 +1,50 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://game/ui/commons/load/load_game.gd" type="Script" id=3]
|
||||
|
||||
[node name="load_game" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
slot_ui_scene = ExtResource( 2 )
|
||||
|
||||
[node name="back" type="Button" parent="."]
|
||||
margin_left = 130.0
|
||||
margin_top = 329.0
|
||||
margin_right = 304.0
|
||||
margin_bottom = 383.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "OPTIONS_BACK"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
anchor_left = 0.291
|
||||
anchor_top = 0.369
|
||||
anchor_right = 0.709
|
||||
anchor_bottom = 0.941
|
||||
margin_left = -0.480011
|
||||
margin_top = -1.10001
|
||||
margin_right = 0.479919
|
||||
margin_bottom = -0.900024
|
||||
scroll_horizontal_enabled = false
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="slots" type="VBoxContainer" parent="ScrollContainer"]
|
||||
margin_right = 536.0
|
||||
margin_bottom = 515.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||
7
game/ui/commons/load_save_slot/load_save_slot.gd
Normal file
7
game/ui/commons/load_save_slot/load_save_slot.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends Button
|
||||
|
||||
|
||||
func set_slot_name_date(p_name: String, p_date: String):
|
||||
$VBoxContainer/slot_name.text = p_name
|
||||
$VBoxContainer/date.text = p_date
|
||||
|
||||
38
game/ui/commons/load_save_slot/load_save_slot.tscn
Normal file
38
game/ui/commons/load_save_slot/load_save_slot.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.gd" type="Script" id=2]
|
||||
|
||||
[node name="slot" type="Button"]
|
||||
margin_right = 665.0
|
||||
margin_bottom = 86.0
|
||||
rect_min_size = Vector2( 0, 100 )
|
||||
size_flags_horizontal = 3
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="slot_name" type="Label" parent="VBoxContainer"]
|
||||
margin_top = 27.0
|
||||
margin_right = 665.0
|
||||
margin_bottom = 48.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "slot_name"
|
||||
align = 1
|
||||
|
||||
[node name="date" type="Label" parent="VBoxContainer"]
|
||||
margin_top = 52.0
|
||||
margin_right = 665.0
|
||||
margin_bottom = 73.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "date"
|
||||
align = 1
|
||||
@@ -25,24 +25,25 @@ func _on_continue_pressed():
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func switch_language(lang : String):
|
||||
func switch_language(lang: String):
|
||||
TranslationServer.set_locale(lang)
|
||||
|
||||
|
||||
func _on_new_game_pressed():
|
||||
escoria.new_game()
|
||||
|
||||
|
||||
func _on_load_game_pressed():
|
||||
# Show Loading screen
|
||||
pass
|
||||
$Panel/main.hide()
|
||||
$Panel/load_game.refresh_savegames()
|
||||
$Panel/load_game.show()
|
||||
|
||||
|
||||
func _on_options_pressed():
|
||||
$Panel/main.hide()
|
||||
$Panel/options.show()
|
||||
|
||||
|
||||
func _on_quit_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
@@ -50,8 +51,12 @@ func _on_quit_pressed():
|
||||
###########################################################################
|
||||
# OPTIONS
|
||||
|
||||
|
||||
func _on_back_pressed():
|
||||
func _on_options_back_button_pressed():
|
||||
$Panel/options.hide()
|
||||
$Panel/main.show()
|
||||
|
||||
|
||||
func _on_load_game_back_button_pressed():
|
||||
$Panel/load_game.hide()
|
||||
$Panel/main.show()
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/main_menu/main_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://game/ui/commons/main_menu/main.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3]
|
||||
[ext_resource path="res://game/ui/commons/main_menu/options.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://game/ui/commons/options/options.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://game/ui/commons/load/load_game.tscn" type="PackedScene" id=5]
|
||||
|
||||
[node name="main_menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@@ -38,11 +39,14 @@ __meta__ = {
|
||||
[node name="options" parent="Panel" instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
|
||||
[node name="load_game" parent="Panel" instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[connection signal="pressed" from="Panel/main/new_game" to="." method="_on_new_game_pressed"]
|
||||
[connection signal="pressed" from="Panel/main/load_game" to="." method="_on_load_game_pressed"]
|
||||
[connection signal="pressed" from="Panel/main/options" to="." method="_on_options_pressed"]
|
||||
[connection signal="pressed" from="Panel/main/quit" to="." method="_on_quit_pressed"]
|
||||
[connection signal="pressed" from="Panel/options/back" to="." method="_on_back_pressed"]
|
||||
[connection signal="back_button_pressed" from="Panel/options" to="." method="_on_options_back_button_pressed"]
|
||||
[connection signal="back_button_pressed" from="Panel/load_game" to="." method="_on_load_game_back_button_pressed"]
|
||||
|
||||
[editable path="Panel/main"]
|
||||
[editable path="Panel/options"]
|
||||
|
||||
@@ -1,35 +1,63 @@
|
||||
extends Control
|
||||
|
||||
signal back_button_pressed
|
||||
|
||||
onready var settings_changed = false
|
||||
onready var backup_settings
|
||||
|
||||
|
||||
func _ready():
|
||||
initialize_options(escoria.settings)
|
||||
|
||||
|
||||
func show():
|
||||
backup_settings = escoria.settings.duplicate()
|
||||
initialize_options(backup_settings)
|
||||
visible = true
|
||||
|
||||
|
||||
func initialize_options(p_settings):
|
||||
$options/general_volume.value = p_settings["master_volume"]
|
||||
$options/sound_volume.value = p_settings["sfx_volume"]
|
||||
$options/music_volume.value = p_settings["music_volume"]
|
||||
|
||||
func greyout_other_languages(except_lang : String) -> void:
|
||||
|
||||
func greyout_other_languages(except_lang: String) -> void:
|
||||
pass
|
||||
|
||||
func _on_language_input(event : InputEvent, language : String):
|
||||
|
||||
func _on_language_input(event: InputEvent, language: String):
|
||||
if event.is_pressed():
|
||||
TranslationServer.set_locale(language)
|
||||
escoria.settings["text_lang"] = language
|
||||
escoria.save_data.save_settings(escoria.settings, null)
|
||||
settings_changed = true
|
||||
|
||||
|
||||
func _on_sound_volume_changed(value):
|
||||
escoria.settings["sfx_volume"] = value
|
||||
escoria.save_data.save_settings(escoria.settings, null)
|
||||
escoria._on_settings_loaded(escoria.settings)
|
||||
settings_changed = true
|
||||
|
||||
|
||||
func _on_music_volume_changed(value):
|
||||
escoria.settings["music_volume"] = value
|
||||
escoria.save_data.save_settings(escoria.settings, null)
|
||||
escoria._on_settings_loaded(escoria.settings)
|
||||
|
||||
settings_changed = true
|
||||
|
||||
|
||||
func _on_general_volume_changed(value):
|
||||
escoria.settings["master_volume"] = value
|
||||
escoria.save_data.save_settings(escoria.settings, null)
|
||||
escoria._on_settings_loaded(escoria.settings)
|
||||
settings_changed = true
|
||||
|
||||
|
||||
func _on_apply_pressed():
|
||||
escoria.save_manager.save_settings()
|
||||
settings_changed = false
|
||||
emit_signal("back_button_pressed")
|
||||
|
||||
|
||||
func _on_back_pressed():
|
||||
escoria.settings = backup_settings
|
||||
escoria._on_settings_loaded(escoria.settings)
|
||||
emit_signal("back_button_pressed")
|
||||
@@ -3,7 +3,7 @@
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://game/ui/commons/main_menu/flags/en_EN_small.png" type="Texture" id=2]
|
||||
[ext_resource path="res://game/ui/commons/main_menu/flags/fr_FR_small.png" type="Texture" id=3]
|
||||
[ext_resource path="res://game/ui/commons/main_menu/options.gd" type="Script" id=4]
|
||||
[ext_resource path="res://game/ui/commons/options/options.gd" type="Script" id=4]
|
||||
|
||||
[node name="options" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@@ -125,8 +125,21 @@ max_value = 1.0
|
||||
step = 0.001
|
||||
value = 0.001
|
||||
|
||||
[node name="apply" type="Button" parent="."]
|
||||
margin_left = 364.0
|
||||
margin_top = 712.0
|
||||
margin_right = 544.0
|
||||
margin_bottom = 767.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "APPLY"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||
[connection signal="gui_input" from="options/flags/fr" to="." method="_on_language_input" binds= [ "fr" ]]
|
||||
[connection signal="gui_input" from="options/flags/en" to="." method="_on_language_input" binds= [ "en" ]]
|
||||
[connection signal="value_changed" from="options/general_volume" to="." method="_on_general_volume_changed"]
|
||||
[connection signal="value_changed" from="options/sound_volume" to="." method="_on_sound_volume_changed"]
|
||||
[connection signal="value_changed" from="options/music_volume" to="." method="_on_music_volume_changed"]
|
||||
[connection signal="pressed" from="apply" to="." method="_on_apply_pressed"]
|
||||
@@ -6,12 +6,25 @@ func _on_continue_pressed():
|
||||
|
||||
|
||||
func _on_save_game_pressed():
|
||||
pass
|
||||
$Panel/VBoxContainer.hide()
|
||||
$save_game.show()
|
||||
|
||||
|
||||
func _on_load_game_pressed():
|
||||
pass
|
||||
$Panel/VBoxContainer.hide()
|
||||
$load_game.refresh_savegames()
|
||||
$load_game.show()
|
||||
|
||||
|
||||
func _on_quit_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_save_game_back_button_pressed():
|
||||
$Panel/VBoxContainer.show()
|
||||
$save_game.hide()
|
||||
|
||||
|
||||
func _on_load_game_back_button_pressed():
|
||||
$Panel/VBoxContainer.show()
|
||||
$load_game.hide()
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/pause_menu/pause_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/escoria-core/logo/escoria-logo-small.png" type="Texture" id=3]
|
||||
[ext_resource path="res://game/ui/commons/save/save_game.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://game/ui/commons/load/load_game.tscn" type="PackedScene" id=5]
|
||||
|
||||
[node name="pause_menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@@ -87,7 +89,15 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="save_game" parent="." instance=ExtResource( 4 )]
|
||||
visible = false
|
||||
|
||||
[node name="load_game" parent="." instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/continue" to="." method="_on_continue_pressed"]
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/save_game" to="." method="_on_save_game_pressed"]
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/load_game" to="." method="_on_load_game_pressed"]
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/quit" to="." method="_on_quit_pressed"]
|
||||
[connection signal="back_button_pressed" from="save_game" to="." method="_on_save_game_back_button_pressed"]
|
||||
[connection signal="back_button_pressed" from="load_game" to="." method="_on_load_game_back_button_pressed"]
|
||||
|
||||
59
game/ui/commons/save/save_game.gd
Normal file
59
game/ui/commons/save/save_game.gd
Normal file
@@ -0,0 +1,59 @@
|
||||
extends Control
|
||||
|
||||
signal back_button_pressed
|
||||
|
||||
export(PackedScene) var slot_ui_scene
|
||||
|
||||
var slot_pressed
|
||||
|
||||
func _ready():
|
||||
refresh_savegames()
|
||||
|
||||
|
||||
func _on_slot_pressed(p_slot_n: int):
|
||||
slot_pressed = p_slot_n
|
||||
if escoria.save_manager.save_game_exists(p_slot_n):
|
||||
# TODO Manage save override, ask for confirmation
|
||||
pass
|
||||
else:
|
||||
$save_name_popup.popup()
|
||||
|
||||
|
||||
func refresh_savegames():
|
||||
for slot in $ScrollContainer/slots.get_children():
|
||||
$ScrollContainer/slots.remove_child(slot)
|
||||
|
||||
var saves_list = escoria.save_manager.get_saves_list()
|
||||
for i in saves_list.size():
|
||||
var save_data = saves_list[i+1]
|
||||
var new_slot = slot_ui_scene.instance()
|
||||
$ScrollContainer/slots.add_child(new_slot)
|
||||
new_slot.set_slot_name_date(save_data["name"], save_data["date"])
|
||||
new_slot.connect("pressed", self, "_on_slot_pressed", [i+1])
|
||||
|
||||
var datetime = OS.get_datetime()
|
||||
var datetime_string = "%02d/%02d/%02d %02d:%02d" % [
|
||||
datetime["day"],
|
||||
datetime["month"],
|
||||
datetime["year"],
|
||||
datetime["hour"],
|
||||
datetime["minute"],
|
||||
]
|
||||
var new_slot = slot_ui_scene.instance()
|
||||
$ScrollContainer/slots.add_child(new_slot)
|
||||
new_slot.set_slot_name_date(tr("New save"), datetime_string)
|
||||
new_slot.connect("pressed", self, "_on_slot_pressed", [saves_list.size()+1])
|
||||
|
||||
|
||||
func _on_back_pressed():
|
||||
emit_signal("back_button_pressed")
|
||||
|
||||
|
||||
func _on_save_name_popup_savegame_name_ok(p_savename: String):
|
||||
escoria.save_manager.save_game(slot_pressed, p_savename)
|
||||
refresh_savegames()
|
||||
slot_pressed = null
|
||||
|
||||
|
||||
func _on_save_name_popup_savegame_cancel():
|
||||
pass
|
||||
54
game/ui/commons/save/save_game.tscn
Normal file
54
game/ui/commons/save/save_game.tscn
Normal file
@@ -0,0 +1,54 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/load_save_slot/load_save_slot.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://game/ui/commons/save/save_game.gd" type="Script" id=2]
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://game/ui/commons/save/save_name_popup.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="save_game" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
slot_ui_scene = ExtResource( 1 )
|
||||
|
||||
[node name="back" type="Button" parent="."]
|
||||
margin_left = 130.0
|
||||
margin_top = 329.0
|
||||
margin_right = 304.0
|
||||
margin_bottom = 383.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "OPTIONS_BACK"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
anchor_left = 0.284
|
||||
anchor_top = 0.367
|
||||
anchor_right = 0.709
|
||||
anchor_bottom = 0.94
|
||||
margin_left = 8.47998
|
||||
margin_top = 0.699982
|
||||
margin_right = 0.479919
|
||||
margin_bottom = -6.10352e-05
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="slots" type="VBoxContainer" parent="ScrollContainer"]
|
||||
margin_right = 536.0
|
||||
margin_bottom = 515.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="save_name_popup" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
[connection signal="pressed" from="back" to="." method="_on_back_pressed"]
|
||||
[connection signal="savegame_cancel" from="save_name_popup" to="." method="_on_save_name_popup_savegame_cancel"]
|
||||
[connection signal="savegame_name_ok" from="save_name_popup" to="." method="_on_save_name_popup_savegame_name_ok"]
|
||||
14
game/ui/commons/save/save_name_popup.gd
Normal file
14
game/ui/commons/save/save_name_popup.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends PopupDialog
|
||||
|
||||
signal savegame_name_ok(savegame_name)
|
||||
signal savegame_cancel
|
||||
|
||||
func _on_cancel_pressed():
|
||||
emit_signal("savegame_cancel")
|
||||
hide()
|
||||
|
||||
func _on_ok_pressed():
|
||||
if not $MarginContainer/VBoxContainer/LineEdit.text.empty():
|
||||
emit_signal("savegame_name_ok", $MarginContainer/VBoxContainer/LineEdit.text)
|
||||
$MarginContainer/VBoxContainer/LineEdit.clear()
|
||||
hide()
|
||||
81
game/ui/commons/save/save_name_popup.tscn
Normal file
81
game/ui/commons/save/save_name_popup.tscn
Normal file
@@ -0,0 +1,81 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://game/ui/commons/fonts/caslonantique.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://game/ui/commons/save/save_name_popup.gd" type="Script" id=2]
|
||||
|
||||
[node name="save_name_popup" type="PopupDialog"]
|
||||
margin_left = 429.0
|
||||
margin_top = 281.0
|
||||
margin_right = 863.0
|
||||
margin_bottom = 442.0
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/margin_right = 30
|
||||
custom_constants/margin_top = 30
|
||||
custom_constants/margin_left = 30
|
||||
custom_constants/margin_bottom = 30
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
margin_left = 30.0
|
||||
margin_top = 30.0
|
||||
margin_right = 404.0
|
||||
margin_bottom = 131.0
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
margin_right = 374.0
|
||||
margin_bottom = 21.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "ENTER_SAVE_NAME"
|
||||
|
||||
[node name="LineEdit" type="LineEdit" parent="MarginContainer/VBoxContainer"]
|
||||
margin_top = 25.0
|
||||
margin_right = 374.0
|
||||
margin_bottom = 56.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -224.0
|
||||
margin_top = -56.0
|
||||
margin_right = -30.0
|
||||
margin_bottom = -20.0
|
||||
custom_constants/separation = 10
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="cancel" type="Button" parent="HBoxContainer"]
|
||||
margin_right = 96.0
|
||||
margin_bottom = 36.0
|
||||
size_flags_horizontal = 3
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "CANCEL"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ok" type="Button" parent="HBoxContainer"]
|
||||
margin_left = 106.0
|
||||
margin_right = 194.0
|
||||
margin_bottom = 36.0
|
||||
size_flags_horizontal = 3
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "OK"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="HBoxContainer/cancel" to="." method="_on_cancel_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/ok" to="." method="_on_ok_pressed"]
|
||||
@@ -4,26 +4,26 @@ extends ESCGame
|
||||
"""
|
||||
Implement methods to react to inputs.
|
||||
|
||||
- left_click_on_bg(position : Vector2)
|
||||
- right_click_on_bg(position : Vector2)
|
||||
- left_double_click_on_bg(position : Vector2)
|
||||
- left_click_on_bg(position: Vector2)
|
||||
- right_click_on_bg(position: Vector2)
|
||||
- left_double_click_on_bg(position: Vector2)
|
||||
|
||||
- element_focused(element_id : String)
|
||||
- element_focused(element_id: String)
|
||||
- element_unfocused()
|
||||
|
||||
- left_click_on_item(item_global_id : String, event : InputEvent)
|
||||
- right_click_on_item(item_global_id : String, event : InputEvent)
|
||||
- left_double_click_on_item(item_global_id : String, event : InputEvent)
|
||||
- left_click_on_item(item_global_id: String, event: InputEvent)
|
||||
- right_click_on_item(item_global_id: String, event: InputEvent)
|
||||
- left_double_click_on_item(item_global_id: String, event: InputEvent)
|
||||
|
||||
- left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
||||
- right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
||||
- left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
||||
- inventory_item_focused(inventory_item_global_id : String)
|
||||
- left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- inventory_item_focused(inventory_item_global_id: String)
|
||||
- inventory_item_unfocused()
|
||||
- open_inventory()
|
||||
- close_inventory()
|
||||
|
||||
- mousewheel_action(direction : int)
|
||||
- mousewheel_action(direction: int)
|
||||
|
||||
- hide_ui()
|
||||
- show_ui()
|
||||
@@ -47,17 +47,17 @@ func _input(event):
|
||||
|
||||
## BACKGROUND ##
|
||||
|
||||
func left_click_on_bg(position : Vector2) -> void:
|
||||
func left_click_on_bg(position: Vector2) -> void:
|
||||
escoria.do("walk", ["player", position])
|
||||
escoria.action_manager.clear_current_action()
|
||||
verbs_menu.unselect_actions()
|
||||
|
||||
func right_click_on_bg(position : Vector2) -> void:
|
||||
func right_click_on_bg(position: Vector2) -> void:
|
||||
escoria.do("walk", ["player", position])
|
||||
escoria.action_manager.clear_current_action()
|
||||
verbs_menu.unselect_actions()
|
||||
|
||||
func left_double_click_on_bg(position : Vector2) -> void:
|
||||
func left_double_click_on_bg(position: Vector2) -> void:
|
||||
escoria.do("walk", ["player", position, true])
|
||||
escoria.action_manager.clear_current_action()
|
||||
verbs_menu.unselect_actions()
|
||||
@@ -65,7 +65,7 @@ func left_double_click_on_bg(position : Vector2) -> void:
|
||||
|
||||
## ITEM FOCUS ##
|
||||
|
||||
func element_focused(element_id : String) -> void:
|
||||
func element_focused(element_id: String) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(element_id).node
|
||||
tooltip.set_target(target_obj.tooltip_name)
|
||||
|
||||
@@ -80,30 +80,30 @@ func element_unfocused() -> void:
|
||||
|
||||
## ITEMS ##
|
||||
|
||||
func left_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
||||
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_left_click", [item_global_id, event])
|
||||
|
||||
func right_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
||||
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.action_manager.set_current_action(verbs_menu.selected_action)
|
||||
escoria.do("item_right_click", [item_global_id, event])
|
||||
|
||||
func left_double_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
||||
func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_left_click", [item_global_id, event])
|
||||
|
||||
|
||||
## INVENTORY ##
|
||||
func left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
||||
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_left_click", [inventory_item_global_id, event])
|
||||
|
||||
|
||||
func right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
||||
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.action_manager.set_current_action(verbs_menu.selected_action)
|
||||
escoria.do("item_right_click", [inventory_item_global_id, event])
|
||||
|
||||
func left_double_click_on_inventory_item(_inventory_item_global_id : String, _event : InputEvent) -> void:
|
||||
func left_double_click_on_inventory_item(_inventory_item_global_id: String, _event: InputEvent) -> void:
|
||||
pass
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id : String) -> void:
|
||||
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node
|
||||
@@ -128,13 +128,14 @@ func close_inventory():
|
||||
pass
|
||||
|
||||
|
||||
func mousewheel_action(_direction : int):
|
||||
func mousewheel_action(_direction: int):
|
||||
pass
|
||||
|
||||
|
||||
func hide_ui():
|
||||
$ui/panel_down.hide()
|
||||
verbs_menu.hide()
|
||||
$ui/panel_down/verbs_layer/room_select.hide()
|
||||
$ui/panel_down/inventory_layer/inventory_ui.hide()
|
||||
tooltip.hide()
|
||||
|
||||
@@ -142,6 +143,7 @@ func hide_ui():
|
||||
func show_ui():
|
||||
$ui/panel_down.show()
|
||||
verbs_menu.show()
|
||||
$ui/panel_down/verbs_layer/room_select.show()
|
||||
$ui/panel_down/inventory_layer/inventory_ui.show()
|
||||
tooltip.show()
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ This script is totally user-defined. It does exactly what the user wants the
|
||||
inventory to look like. It only requires 4 functions to be defined:
|
||||
- is_empty() -> bool
|
||||
- get_items() -> Array
|
||||
- add_item(inventory_item : ESCInventoryItem)
|
||||
- remove_item(inventory_item : ESCInventoryItem)
|
||||
- add_item(inventory_item: ESCInventoryItem)
|
||||
- remove_item(inventory_item: ESCInventoryItem)
|
||||
The user is free to implement these methods the way s-he likes.
|
||||
"""
|
||||
|
||||
@@ -18,7 +18,7 @@ func is_empty() -> bool:
|
||||
func get_items() -> Array:
|
||||
return current_nodes_in_container.keys()
|
||||
|
||||
func add_item(inventory_item : ESCInventoryItem):
|
||||
func add_item(inventory_item: ESCInventoryItem):
|
||||
var center_container = CenterContainer.new()
|
||||
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||
@@ -28,7 +28,7 @@ func add_item(inventory_item : ESCInventoryItem):
|
||||
add_child(center_container)
|
||||
current_nodes_in_container[inventory_item] = center_container
|
||||
|
||||
func remove_item(inventory_item : ESCInventoryItem):
|
||||
func remove_item(inventory_item: ESCInventoryItem):
|
||||
var node_to_remove = current_nodes_in_container[inventory_item]
|
||||
current_nodes_in_container.erase(node_to_remove)
|
||||
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||
|
||||
@@ -13,7 +13,7 @@ func _ready():
|
||||
but.connect("pressed", self, "_on_action_selected", [but.name])
|
||||
but.toggle_mode = true
|
||||
|
||||
func _on_action_selected(action : String):
|
||||
func _on_action_selected(action: String):
|
||||
escoria.action_manager.set_current_action(action)
|
||||
|
||||
for but in get_children():
|
||||
@@ -23,7 +23,7 @@ func unselect_actions():
|
||||
for but in get_children():
|
||||
but.set_pressed(false)
|
||||
|
||||
func set_by_name(action_name : String):
|
||||
func set_by_name(action_name: String):
|
||||
selected_action = action_name
|
||||
for but in get_children():
|
||||
but.set_pressed(but.get_name() == action_name)
|
||||
|
||||
@@ -4,26 +4,26 @@ extends ESCGame
|
||||
"""
|
||||
Implement methods to react to inputs.
|
||||
|
||||
- left_click_on_bg(position : Vector2)
|
||||
- right_click_on_bg(position : Vector2)
|
||||
- left_double_click_on_bg(position : Vector2)
|
||||
- left_click_on_bg(position: Vector2)
|
||||
- right_click_on_bg(position: Vector2)
|
||||
- left_double_click_on_bg(position: Vector2)
|
||||
|
||||
- element_focused(element_id : String)
|
||||
- element_focused(element_id: String)
|
||||
- element_unfocused()
|
||||
|
||||
- left_click_on_item(item_global_id : String, event : InputEvent)
|
||||
- right_click_on_item(item_global_id : String, event : InputEvent)
|
||||
- left_double_click_on_item(item_global_id : String, event : InputEvent)
|
||||
- left_click_on_item(item_global_id: String, event: InputEvent)
|
||||
- right_click_on_item(item_global_id: String, event: InputEvent)
|
||||
- left_double_click_on_item(item_global_id: String, event: InputEvent)
|
||||
|
||||
- left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
||||
- right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
||||
- left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent)
|
||||
- inventory_item_focused(inventory_item_global_id : String)
|
||||
- left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent)
|
||||
- inventory_item_focused(inventory_item_global_id: String)
|
||||
- inventory_item_unfocused()
|
||||
- open_inventory()
|
||||
- close_inventory()
|
||||
|
||||
- mousewheel_action(direction : int)
|
||||
- mousewheel_action(direction: int)
|
||||
|
||||
- hide_ui()
|
||||
- show_ui()
|
||||
@@ -37,24 +37,24 @@ func _ready():
|
||||
|
||||
## BACKGROUND ##
|
||||
|
||||
func left_click_on_bg(position : Vector2) -> void:
|
||||
func left_click_on_bg(position: Vector2) -> void:
|
||||
escoria.do("walk", ["player", position])
|
||||
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||
|
||||
func right_click_on_bg(position : Vector2) -> void:
|
||||
func right_click_on_bg(position: Vector2) -> void:
|
||||
escoria.do("walk", ["player", position])
|
||||
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||
|
||||
func left_double_click_on_bg(position : Vector2) -> void:
|
||||
func left_double_click_on_bg(position: Vector2) -> void:
|
||||
escoria.do("walk", ["player", position, true])
|
||||
$ui/verbs_layer/verbs_menu.set_by_name("walk")
|
||||
$ui/verbs_layer/verbs_menu.clear_tool_texture()
|
||||
|
||||
## ITEM/HOTSPOT FOCUS ##
|
||||
|
||||
func element_focused(element_id : String) -> void:
|
||||
func element_focused(element_id: String) -> void:
|
||||
var target_obj = escoria.object_manager.get_object(element_id).node
|
||||
$ui/tooltip_layer/tooltip.set_target(target_obj.tooltip_name)
|
||||
|
||||
@@ -69,42 +69,49 @@ func element_unfocused() -> void:
|
||||
|
||||
## ITEMS ##
|
||||
|
||||
func left_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
||||
func left_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_left_click", [item_global_id, event])
|
||||
|
||||
func right_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
||||
func right_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_right_click", [item_global_id, event])
|
||||
|
||||
func left_double_click_on_item(item_global_id : String, event : InputEvent) -> void:
|
||||
func left_double_click_on_item(item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_left_click", [item_global_id, event])
|
||||
|
||||
|
||||
## INVENTORY ##
|
||||
func left_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
||||
func left_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_left_click", [inventory_item_global_id, event])
|
||||
if escoria.action_manager.current_action == "use":
|
||||
var item = escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node
|
||||
if item.get_node("sprite").texture:
|
||||
$ui/verbs_layer/verbs_menu.set_tool_texture(item.get_node("sprite").texture)
|
||||
$ui/verbs_layer/verbs_menu.set_tool_texture(
|
||||
item.get_node("sprite").texture
|
||||
)
|
||||
elif item.inventory_item.texture_normal:
|
||||
$ui/verbs_layer/verbs_menu.set_tool_texture(item.inventory_item.texture_normal)
|
||||
$ui/verbs_layer/verbs_menu.set_tool_texture(
|
||||
item.inventory_item.texture_normal
|
||||
)
|
||||
|
||||
|
||||
func right_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
||||
func right_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
escoria.do("item_right_click", [inventory_item_global_id, event])
|
||||
|
||||
func left_double_click_on_inventory_item(inventory_item_global_id : String, event : InputEvent) -> void:
|
||||
|
||||
func left_double_click_on_inventory_item(inventory_item_global_id: String, event: InputEvent) -> void:
|
||||
pass
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id : String) -> void:
|
||||
|
||||
func inventory_item_focused(inventory_item_global_id: String) -> void:
|
||||
$ui/tooltip_layer/tooltip.set_target(
|
||||
escoria.object_manager.get_object(
|
||||
inventory_item_global_id
|
||||
).node.tooltip_name
|
||||
)
|
||||
|
||||
|
||||
func inventory_item_unfocused() -> void:
|
||||
$ui/tooltip_layer/tooltip.set_target("")
|
||||
|
||||
@@ -116,7 +123,7 @@ func open_inventory():
|
||||
func close_inventory():
|
||||
$ui/inventory_layer/inventory_ui/inventory_button.close_inventory()
|
||||
|
||||
func mousewheel_action(direction : int):
|
||||
func mousewheel_action(direction: int):
|
||||
$ui/verbs_layer/verbs_menu.iterate_actions_cursor(direction)
|
||||
|
||||
func hide_ui():
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
extends Control
|
||||
|
||||
var showed : bool = false
|
||||
var showed: bool = false
|
||||
|
||||
func _ready():
|
||||
pass
|
||||
|
||||
@@ -5,8 +5,8 @@ This script is totally user-defined. It does exactly what the user wants the
|
||||
inventory to look like. It only requires 4 functions to be defined:
|
||||
- is_empty() -> bool
|
||||
- get_items() -> Array
|
||||
- add_item(inventory_item : ESCInventoryItem)
|
||||
- remove_item(inventory_item : ESCInventoryItem)
|
||||
- add_item(inventory_item: ESCInventoryItem)
|
||||
- remove_item(inventory_item: ESCInventoryItem)
|
||||
The user is free to implement these methods the way s-he likes.
|
||||
"""
|
||||
|
||||
@@ -18,7 +18,7 @@ func is_empty() -> bool:
|
||||
func get_items() -> Array:
|
||||
return current_nodes_in_container.keys()
|
||||
|
||||
func add_item(inventory_item : ESCInventoryItem):
|
||||
func add_item(inventory_item: ESCInventoryItem):
|
||||
var center_container = CenterContainer.new()
|
||||
center_container.size_flags_horizontal = SIZE_EXPAND_FILL
|
||||
center_container.connect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||
@@ -27,7 +27,7 @@ func add_item(inventory_item : ESCInventoryItem):
|
||||
add_child(center_container)
|
||||
current_nodes_in_container[inventory_item] = center_container
|
||||
|
||||
func remove_item(inventory_item : ESCInventoryItem):
|
||||
func remove_item(inventory_item: ESCInventoryItem):
|
||||
var node_to_remove = current_nodes_in_container[inventory_item]
|
||||
current_nodes_in_container.erase(node_to_remove)
|
||||
node_to_remove.disconnect("mouse_entered", inventory_item, "_on_inventory_item_mouse_enter")
|
||||
|
||||
@@ -2,8 +2,8 @@ tool
|
||||
extends Control
|
||||
|
||||
|
||||
var current_cursor_id : int = 0
|
||||
onready var cursors : Array = $actions.get_children()
|
||||
var current_cursor_id: int = 0
|
||||
onready var cursors: Array = $actions.get_children()
|
||||
|
||||
|
||||
"""
|
||||
@@ -24,7 +24,7 @@ func _process(delta):
|
||||
$mouse_position.rect_global_position = get_global_mouse_position()
|
||||
|
||||
|
||||
func iterate_actions_cursor(direction : int):
|
||||
func iterate_actions_cursor(direction: int):
|
||||
current_cursor_id += direction
|
||||
if current_cursor_id > cursors.size() - 1:
|
||||
current_cursor_id = 0
|
||||
@@ -36,7 +36,7 @@ func iterate_actions_cursor(direction : int):
|
||||
if $mouse_position/tool.texture != null:
|
||||
clear_tool_texture()
|
||||
|
||||
func set_by_name(name : String) -> void:
|
||||
func set_by_name(name: String) -> void:
|
||||
for i in cursors.size():
|
||||
if cursors[i].name == name:
|
||||
current_cursor_id = i
|
||||
@@ -45,7 +45,7 @@ func set_by_name(name : String) -> void:
|
||||
Input.set_custom_mouse_cursor(cursors[current_cursor_id].texture)
|
||||
escoria.action_manager.set_current_action(cursors[current_cursor_id].name)
|
||||
|
||||
func set_tool_texture(texture : Texture):
|
||||
func set_tool_texture(texture: Texture):
|
||||
set_process(true)
|
||||
$mouse_position/tool.texture = texture
|
||||
|
||||
|
||||
Reference in New Issue
Block a user