Compare commits
4 Commits
d8bc800077
...
b3220f968d
Author | SHA1 | Date |
---|---|---|
|
b3220f968d | |
|
dc3ead30b4 | |
|
d026c07804 | |
|
4b8479e87e |
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"godotTools.editorPath.godot4": "g:\\Godot\\Godot_v4.3-stable_win64_console.exe"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 436 KiB |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://di16cmfomo60u"
|
||||
path="res://.godot/imported/Intro.png-ef37c38298536b7c161e4863253f3325.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/images/Intro.png"
|
||||
dest_files=["res://.godot/imported/Intro.png-ef37c38298536b7c161e4863253f3325.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=45 format=4 uid="uid://b88asko1ugyd2"]
|
||||
[gd_scene load_steps=46 format=4 uid="uid://b88asko1ugyd2"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/global/GameManager.gd" id="1_eeg2d"]
|
||||
[ext_resource type="Script" path="res://scripts/tilemap/World.gd" id="1_k0rw8"]
|
||||
[ext_resource type="TileSet" uid="uid://bi836ygcmyvhb" path="res://assets/tilemap/tileset.tres" id="1_vlccq"]
|
||||
[ext_resource type="Script" path="res://scripts/global/CameraController.gd" id="2_k51iv"]
|
||||
[ext_resource type="Material" uid="uid://ckg3be082ny3h" path="res://assets/shader/shader_vignette.tres" id="3_7waul"]
|
||||
[ext_resource type="Texture2D" uid="uid://di16cmfomo60u" path="res://assets/images/Intro.png" id="3_oufrl"]
|
||||
[ext_resource type="Script" path="res://scripts/player/PlayerManager.gd" id="4_1xqo1"]
|
||||
[ext_resource type="Texture2D" uid="uid://1ae5agveqddp" path="res://icon.svg" id="4_o8ona"]
|
||||
[ext_resource type="Script" path="res://scripts/visualization/BehaviorTreeVisualizer.gd" id="5_ecfvx"]
|
||||
|
@ -68,6 +69,7 @@ size_flags_horizontal = 4
|
|||
[node name="TopLeftContainer" type="MarginContainer" parent="Camera2D/CanvasLayer"]
|
||||
offset_right = 204.0
|
||||
offset_bottom = 122.0
|
||||
scale = Vector2(1.3, 1.3)
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
|
||||
|
@ -202,6 +204,7 @@ anchor_bottom = 1.0
|
|||
offset_top = -5.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
size_flags_vertical = 8
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
|
@ -213,8 +216,9 @@ size_flags_vertical = 8
|
|||
|
||||
[node name="TreeVisualizer" type="Window" parent="Camera2D/CanvasLayer"]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2i(35, 405)
|
||||
position = Vector2i(0, 36)
|
||||
size = Vector2i(1075, 225)
|
||||
visible = false
|
||||
script = ExtResource("5_ecfvx")
|
||||
|
||||
[node name="GraphEdit" type="GraphEdit" parent="Camera2D/CanvasLayer/TreeVisualizer"]
|
||||
|
@ -226,13 +230,18 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
scroll_offset = Vector2(-100, -100)
|
||||
show_menu = false
|
||||
show_zoom_buttons = false
|
||||
show_grid_buttons = false
|
||||
show_minimap_button = false
|
||||
show_arrange_button = false
|
||||
|
||||
[node name="IntroImage" type="Sprite2D" parent="Camera2D"]
|
||||
visible = false
|
||||
z_index = 1
|
||||
scale = Vector2(0.347656, 0.373264)
|
||||
texture = ExtResource("3_oufrl")
|
||||
|
||||
[node name="Tileset" type="Node2D" parent="."]
|
||||
script = ExtResource("1_k0rw8")
|
||||
|
||||
|
|
|
@ -78,12 +78,12 @@ key_9={
|
|||
}
|
||||
force_game_tick={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":84,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
force_game_tick_fast={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":71,"key_label":0,"unicode":103,"location":0,"echo":false,"script":null)
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
key_4={
|
||||
|
@ -106,6 +106,11 @@ key_6={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":54,"key_label":0,"unicode":54,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
auto_tick={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ enum Event {
|
|||
};
|
||||
#
|
||||
static var events: Array[TrackedEvent] = []
|
||||
static var max_events: int = 20
|
||||
static var max_events: int = 14
|
||||
static var callbacks: Array[Callable] = []
|
||||
|
||||
|
||||
|
@ -79,9 +79,9 @@ static func populate_visual_log_create_label(event: TrackedEvent, container: Con
|
|||
elif event_id == Event.GAME_STATE_WIN:
|
||||
text = "Game won"
|
||||
elif event_id == Event.NEW_EXPLORATION_GOAL:
|
||||
text = "New exploration goal " + str(params["goal"])
|
||||
text = "New goal " + str(params["goal"])
|
||||
elif event_id == Event.EXPLORATION_GOAL_REACHED:
|
||||
text = "Exploration goal reached " + str(params["goal"])
|
||||
text = "Goal reached"
|
||||
elif event_id == Event.TEMPERATURE_COLD:
|
||||
text = "Temperature is cold: -" + str(params["temperature"])
|
||||
elif event_id == Event.TIME_SUNDOWN:
|
||||
|
@ -91,6 +91,7 @@ static func populate_visual_log_create_label(event: TrackedEvent, container: Con
|
|||
|
||||
var event_label: Label = Label.new()
|
||||
event_label.text = text
|
||||
event_label.add_theme_font_size_override("font_size", 24 * game_manager.calculate_scale(Vector2(1200, 1200)).y)
|
||||
event_label.add_theme_color_override("font_color", Color(0, 0, 0))
|
||||
|
||||
var event_container: HBoxContainer = HBoxContainer.new()
|
||||
|
@ -101,6 +102,8 @@ static func populate_visual_log_create_label(event: TrackedEvent, container: Con
|
|||
if item_texture:
|
||||
var item_texture_rect: TextureRect = TextureRect.new()
|
||||
item_texture_rect.texture = item_texture
|
||||
item_texture_rect.set_expand_mode(TextureRect.EXPAND_FIT_WIDTH)
|
||||
item_texture_rect.set_stretch_mode(TextureRect.STRETCH_KEEP_ASPECT_CENTERED)
|
||||
event_container.add_child(item_texture_rect)
|
||||
|
||||
container.add_child(event_container)
|
||||
|
|
|
@ -17,6 +17,11 @@ var tilemap_navigation: TilemapNavigation = TilemapNavigation.new()
|
|||
|
||||
@onready var tree_visualizer: BehaviorTreeVisualizer = %TreeVisualizer
|
||||
|
||||
#
|
||||
var waiting_for_input: bool = true
|
||||
|
||||
@onready var intro_image: Sprite2D = $Camera2D/IntroImage
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
tilemap_navigation.world = world
|
||||
|
@ -28,32 +33,51 @@ func _ready() -> void:
|
|||
update_bars()
|
||||
call_deferred("defer_ready")
|
||||
|
||||
|
||||
func defer_ready() -> void:
|
||||
tree_visualizer.behavior_tree = player.behavior_tree
|
||||
tree_visualizer.build_tree()
|
||||
|
||||
intro_image.visible = true
|
||||
await wait_for_key_press()
|
||||
get_tree().create_tween().tween_method(set_intro_opacity, 1.0, 0.0, 1.0)
|
||||
|
||||
|
||||
# game_ticker.start()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("key_1"):
|
||||
camera.go_to_zooming(Vector2(517.469787597656, 289.846008300781), 1.771561)
|
||||
if Input.is_action_just_pressed("key_2"):
|
||||
camera.go_to_zooming(Vector2(789.883972167969, 450.102813720703), 0.56015348434448)
|
||||
if Input.is_action_just_pressed("key_9"):
|
||||
world.camp_manager.campfire_light()
|
||||
world.camp_manager.sleep_effect()
|
||||
world.camp_manager.campfire_extinguish()
|
||||
if Input.is_action_just_pressed("force_game_tick"):
|
||||
Task.print_behavior_tree_evaluation = true
|
||||
_on_game_tick_timeout()
|
||||
Task.print_behavior_tree_evaluation = false
|
||||
if Input.is_action_pressed("force_game_tick_fast"):
|
||||
_on_game_tick_timeout()
|
||||
if Input.is_action_just_pressed("key_6"):
|
||||
if Input.is_action_just_pressed("key_2"):
|
||||
toggle_temperature_layer()
|
||||
camera.print_config()
|
||||
if Input.is_action_just_pressed("auto_tick"):
|
||||
if game_ticker.is_stopped():
|
||||
game_ticker.start()
|
||||
else:
|
||||
game_ticker.stop()
|
||||
|
||||
if intro_image.is_visible():
|
||||
intro_image.set_scale(calculate_scale(intro_image.texture.get_size()))
|
||||
|
||||
|
||||
func calculate_scale(image_size: Vector2) -> Vector2:
|
||||
var viewport_size: Vector2 = world.get_viewport_rect().size
|
||||
var scale: float = viewport_size.x / image_size.x
|
||||
return Vector2(scale, scale)
|
||||
|
||||
|
||||
# SECTION: intro
|
||||
|
||||
func set_intro_opacity(opacity: float) -> void:
|
||||
intro_image.set_modulate(Color(1, 1, 1, opacity))
|
||||
|
||||
|
||||
# SECTION: game tick
|
||||
|
||||
func player_health_depleted():
|
||||
# TODO
|
||||
|
@ -76,9 +100,40 @@ func _on_game_tick_timeout() -> void:
|
|||
update_bars()
|
||||
handle_result_game_state(player.behavior_tree.blackboard)
|
||||
|
||||
if not game_ticker.is_stopped():
|
||||
camera_follow_player()
|
||||
|
||||
timer_on_game_tick_timeout.stop()
|
||||
|
||||
|
||||
func camera_follow_player() -> void:
|
||||
var player_position: Vector2 = world.tilemap_player.cell_to_local(player.board_position)
|
||||
var targeted_position = null
|
||||
|
||||
if player.behavior_tree.blackboard.has("path"):
|
||||
var path: Array = player.behavior_tree.blackboard["path"]
|
||||
if path.size() > 0:
|
||||
targeted_position = world.tilemap_player.cell_to_local(path[path.size() - 1])
|
||||
|
||||
if not targeted_position:
|
||||
camera.go_to(player_position)
|
||||
return
|
||||
|
||||
var avg_position = (player_position + targeted_position) / 2
|
||||
var distance: float = player_position.distance_to(targeted_position)
|
||||
if distance < 200:
|
||||
camera.go_to_zooming(avg_position, distance_to_zoom_level(200))
|
||||
else:
|
||||
var zoom_level: float = distance_to_zoom_level(distance)
|
||||
camera.go_to_zooming(avg_position, zoom_level)
|
||||
|
||||
|
||||
func distance_to_zoom_level(distance: float) -> float:
|
||||
var a: float = 862.08
|
||||
var b: float = 274.13
|
||||
return a / (distance + b)
|
||||
|
||||
|
||||
func handle_result_game_state(blackboard: Dictionary) -> void:
|
||||
if blackboard.has("game_state_win"):
|
||||
EventsTracker.track(EventsTracker.Event.GAME_STATE_WIN)
|
||||
|
@ -112,3 +167,14 @@ func update_bars() -> void:
|
|||
|
||||
func toggle_temperature_layer() -> void:
|
||||
world.tilemap_temperature.tilemap.visible = not world.tilemap_temperature.tilemap.visible
|
||||
|
||||
|
||||
func wait_for_key_press():
|
||||
waiting_for_input = true
|
||||
while waiting_for_input:
|
||||
await get_tree().process_frame
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventKey and event.pressed:
|
||||
waiting_for_input = false
|
||||
|
|
|
@ -55,7 +55,7 @@ func defer_ready() -> void:
|
|||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_just_pressed("key_3"):
|
||||
if Input.is_action_just_pressed("key_1"):
|
||||
game_manager.camera.go_to_zooming(game_manager.world.tilemap_player.cell_to_local(board_position), 2)
|
||||
if Input.is_action_just_pressed("key_5"):
|
||||
pick_up_item(Vector2i(5, 8))
|
||||
|
|
Loading…
Reference in New Issue