diff --git a/project/main-scenes/island.tscn b/project/main-scenes/island.tscn index bec4894..29b5b9b 100644 --- a/project/main-scenes/island.tscn +++ b/project/main-scenes/island.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=4 uid="uid://b88asko1ugyd2"] +[gd_scene load_steps=9 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"] @@ -7,6 +7,7 @@ [ext_resource type="Script" path="res://scripts/player/PlayerManager.gd" id="4_1xqo1"] [ext_resource type="Script" path="res://scripts/player/tree/BehaviorTree.gd" id="6_efs30"] [ext_resource type="Script" path="res://scripts/player/tree/impl/base/TaskSelector.gd" id="7_1jajd"] +[ext_resource type="Script" path="res://scripts/player/tree/impl/context/WalkToMouse.gd" id="8_qs3d0"] [node name="Island-scene" type="Node2D"] script = ExtResource("1_eeg2d") @@ -38,7 +39,6 @@ tile_map_data = PackedByteArray("AAAOAAkAAQACAAAAAAANAAkAAQACAAAAAAANAAoAAQACAAA tile_set = ExtResource("1_vlccq") [node name="InteractiveObjectsLayer" type="TileMapLayer" parent="Tileset"] -scale = Vector2(0.979337, 1.0577) tile_map_data = PackedByteArray("AAASABYAAQAAAAEAAAAWAAoAAQAAAAEAAAALABkAAQAAAAIAAAATABwAAQAAAAMAAAASAA8AAQAAAAMAAAAQAAUAAQAAAAMAAAAhAAkAAQAAAAMAAAAKABkAAQAAAAQAAABEACIAAQAAAAUAAABsADUAAQAAAAYAAABwAA8AAQAAAAcAAAAUAAYAAQADAAEAAAAXAAYAAQADAAAAAAARAAYAAQAEAAAAAAAJAAkAAQADAAEAAAAFAAgAAQADAAEAAAAFAAwAAQADAAEAAAAJAAwAAQADAAEAAAA=") tile_set = ExtResource("1_vlccq") @@ -57,3 +57,11 @@ script = ExtResource("6_efs30") [node name="sl_Root" type="Node" parent="PlayerManager/BehaviorTree"] script = ExtResource("7_1jajd") + +[node name="Node" type="Node" parent="PlayerManager/BehaviorTree/sl_Root"] +script = ExtResource("8_qs3d0") + +[node name="GameTick" type="Timer" parent="."] +wait_time = 0.1 + +[connection signal="timeout" from="GameTick" to="." method="_on_game_tick_timeout"] diff --git a/project/scripts/global/GameManager.gd b/project/scripts/global/GameManager.gd index ccf92be..b292e02 100644 --- a/project/scripts/global/GameManager.gd +++ b/project/scripts/global/GameManager.gd @@ -8,27 +8,28 @@ extends Node func _ready() -> void: - player.game_manager = self + player.game_manager = self + 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"): - camera.print_config() - if Input.is_action_just_pressed("force_game_tick"): - player.game_tick() + 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"): + camera.print_config() + if Input.is_action_just_pressed("force_game_tick"): + player.game_tick() func player_health_depleted(): - # TODO - pass + # TODO + pass func _on_game_tick_timeout() -> void: - var timer_on_game_tick_timeout: PerformanceTimer = PerformanceTimer.new() - timer_on_game_tick_timeout.display_name = "_on_game_tick_timeout" - player.game_tick() - timer_on_game_tick_timeout.stop() + var timer_on_game_tick_timeout: PerformanceTimer = PerformanceTimer.new() + timer_on_game_tick_timeout.display_name = "_on_game_tick_timeout" + player.game_tick() + timer_on_game_tick_timeout.stop() diff --git a/project/scripts/tilemap/World.gd b/project/scripts/tilemap/World.gd index 518bfd3..51599b9 100644 --- a/project/scripts/tilemap/World.gd +++ b/project/scripts/tilemap/World.gd @@ -37,6 +37,10 @@ func _ready() -> void: # tilemap_ground.set_cell(Vector2i(0, 0), tilemap_types.GROUND_GRASS) # print(tilemap_ground.local_to_cell(get_local_mouse_position())) +func tilemap_mouse_position() -> Vector2i: + return tilemap_ground.local_to_cell(get_local_mouse_position()) + + func find_item_drop_location(center_pos: Vector2i) -> Vector2i: for x in range(center_pos.x - 2, center_pos.x + 2): for y in range(center_pos.y - 2, center_pos.y + 2):