From 502d0c440d714854f19eb7a95ea7d81b97b10bbd Mon Sep 17 00:00:00 2001 From: snoweuph Date: Thu, 2 Feb 2023 22:53:12 +0100 Subject: [PATCH] Reworked Enemy from scratch. Only Looking is done yet --- Assets/Textures/basic_enemy.png | Bin 6799 -> 157 bytes Assets/Textures/basic_enemy.png.import | 2 +- Assets/Tilesets/colony.tres | 53 ++++++------ Scenes/Test Scene.tscn | 42 +++++----- Scripts/Enemy/EnemyLook.gd | 108 +++++++++++++++++++++++++ Scripts/Enemy/EnemyMovement.gd | 19 ----- project.godot | 6 ++ 7 files changed, 162 insertions(+), 68 deletions(-) create mode 100644 Scripts/Enemy/EnemyLook.gd delete mode 100644 Scripts/Enemy/EnemyMovement.gd diff --git a/Assets/Textures/basic_enemy.png b/Assets/Textures/basic_enemy.png index e8c3be411b3f20ec59ee055aa74cd2225e3ae771..be20e149f4308644cb93e1c99c38258d525fcacd 100644 GIT binary patch delta 129 zcmV-{0Dk|EHJt&FBYFSPx#S4l)cR0x@E$*~E5KoAAd(FQIMF1sGK z2Vo0X*u);LEsGE=$>1vZMk0bQoB<$uYTaCb%uE1N^whWpk8?jTGiH9&TK@;|9c3xB j*4_|36+H#W-34$1W;+$y$yDRt00000NkvXXu0mjf0g^Ep literal 6799 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 diff --git a/Assets/Textures/basic_enemy.png.import b/Assets/Textures/basic_enemy.png.import index dd1b928..ac7a97a 100644 --- a/Assets/Textures/basic_enemy.png.import +++ b/Assets/Textures/basic_enemy.png.import @@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653ef [params] compress/mode=0 +compress/high_quality=false compress/lossy_quality=0.7 compress/hdr_compression=1 -compress/bptc_ldr=0 compress/normal_map=0 compress/channel_pack=0 mipmaps/generate=false diff --git a/Assets/Tilesets/colony.tres b/Assets/Tilesets/colony.tres index df5e986..18e1b26 100644 --- a/Assets/Tilesets/colony.tres +++ b/Assets/Tilesets/colony.tres @@ -28,7 +28,7 @@ texture = ExtResource("1") 0:1/0/terrains_peering_bit/top_right_corner = 0 0:2/size_in_atlas = Vector2i(1, 2) 0:2/0 = 0 -0:2/0/texture_offset = Vector2i(0, -8) +0:2/0/texture_origin = Vector2i(0, -8) 0:2/0/terrain_set = 0 0:2/0/terrain = 0 0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -40,7 +40,7 @@ texture = ExtResource("1") 0:2/0/terrains_peering_bit/top_right_corner = 0 1:2/size_in_atlas = Vector2i(1, 2) 1:2/0 = 0 -1:2/0/texture_offset = Vector2i(0, -8) +1:2/0/texture_origin = Vector2i(0, -8) 1:2/0/terrain_set = 0 1:2/0/terrain = 0 1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -99,7 +99,7 @@ texture = ExtResource("1") 2:1/0/terrains_peering_bit/top_side = 0 2:2/size_in_atlas = Vector2i(1, 2) 2:2/0 = 0 -2:2/0/texture_offset = Vector2i(0, -8) +2:2/0/texture_origin = Vector2i(0, -8) 2:2/0/terrain_set = 0 2:2/0/terrain = 0 2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -198,7 +198,7 @@ texture = ExtResource("1") 5:1/0/terrains_peering_bit/top_side = 0 5:2/size_in_atlas = Vector2i(1, 2) 5:2/0 = 0 -5:2/0/texture_offset = Vector2i(0, -8) +5:2/0/texture_origin = Vector2i(0, -8) 5:2/0/terrain_set = 0 5:2/0/terrain = 0 5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -259,7 +259,7 @@ texture = ExtResource("1") 7:1/0/terrains_peering_bit/left_side = 0 7:2/size_in_atlas = Vector2i(1, 2) 7:2/0 = 0 -7:2/0/texture_offset = Vector2i(0, -8) +7:2/0/texture_origin = Vector2i(0, -8) 7:2/0/terrain_set = 0 7:2/0/terrain = 0 7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -271,7 +271,7 @@ texture = ExtResource("1") 7:2/0/terrains_peering_bit/top_side = 0 6:2/size_in_atlas = Vector2i(1, 2) 6:2/0 = 0 -6:2/0/texture_offset = Vector2i(0, -8) +6:2/0/texture_origin = Vector2i(0, -8) 6:2/0/terrain_set = 0 6:2/0/terrain = 0 6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -283,7 +283,7 @@ texture = ExtResource("1") 6:2/0/terrains_peering_bit/top_side = 0 19:2/size_in_atlas = Vector2i(1, 2) 19:2/0 = 0 -19:2/0/texture_offset = Vector2i(0, -8) +19:2/0/texture_origin = Vector2i(0, -8) 19:2/0/terrain_set = 0 19:2/0/terrain = 1 19:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -295,7 +295,7 @@ texture = ExtResource("1") 19:2/0/terrains_peering_bit/top_side = 1 18:2/size_in_atlas = Vector2i(1, 2) 18:2/0 = 0 -18:2/0/texture_offset = Vector2i(0, -8) +18:2/0/texture_origin = Vector2i(0, -8) 18:2/0/terrain_set = 0 18:2/0/terrain = 1 18:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -307,7 +307,7 @@ texture = ExtResource("1") 18:2/0/terrains_peering_bit/top_side = 1 17:2/size_in_atlas = Vector2i(1, 2) 17:2/0 = 0 -17:2/0/texture_offset = Vector2i(0, -8) +17:2/0/texture_origin = Vector2i(0, -8) 17:2/0/terrain_set = 0 17:2/0/terrain = 1 17:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -344,7 +344,7 @@ texture = ExtResource("1") 15:2/0/terrains_peering_bit/top_right_corner = 1 14:2/size_in_atlas = Vector2i(1, 2) 14:2/0 = 0 -14:2/0/texture_offset = Vector2i(0, -8) +14:2/0/texture_origin = Vector2i(0, -8) 14:2/0/terrain_set = 0 14:2/0/terrain = 1 14:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -382,7 +382,7 @@ texture = ExtResource("1") 15:3/0/terrains_peering_bit/top_right_corner = 1 13:2/size_in_atlas = Vector2i(1, 2) 13:2/0 = 0 -13:2/0/texture_offset = Vector2i(0, -8) +13:2/0/texture_origin = Vector2i(0, -8) 13:2/0/terrain_set = 0 13:2/0/terrain = 1 13:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -395,7 +395,7 @@ texture = ExtResource("1") 13:2/0/terrains_peering_bit/top_right_corner = 1 12:2/size_in_atlas = Vector2i(1, 2) 12:2/0 = 0 -12:2/0/texture_offset = Vector2i(0, -8) +12:2/0/texture_origin = Vector2i(0, -8) 12:2/0/terrain_set = 0 12:2/0/terrain = 1 12:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -559,7 +559,7 @@ texture = ExtResource("1") 12:1/0/terrains_peering_bit/top_right_corner = 1 8:2/size_in_atlas = Vector2i(1, 2) 8:2/0 = 0 -8:2/0/texture_offset = Vector2i(0, -8) +8:2/0/texture_origin = Vector2i(0, -8) 8:2/0/terrain_set = 0 8:2/0/terrain = 0 8:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -765,7 +765,7 @@ texture = ExtResource("1") 20:1/0/terrains_peering_bit/top_side = 1 20:2/size_in_atlas = Vector2i(1, 2) 20:2/0 = 0 -20:2/0/texture_offset = Vector2i(0, -8) +20:2/0/texture_origin = Vector2i(0, -8) 20:2/0/terrain_set = 0 20:2/0/terrain = 1 20:2/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -874,7 +874,7 @@ texture = ExtResource("1") 0:4/0/terrains_peering_bit/bottom_side = 0 1:4/size_in_atlas = Vector2i(1, 2) 1:4/0 = 0 -1:4/0/texture_offset = Vector2i(0, -8) +1:4/0/texture_origin = Vector2i(0, -8) 1:4/0/terrain_set = 0 1:4/0/terrain = 0 1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -883,7 +883,7 @@ texture = ExtResource("1") 1:4/0/terrains_peering_bit/top_side = 0 2:4/size_in_atlas = Vector2i(1, 2) 2:4/0 = 0 -2:4/0/texture_offset = Vector2i(0, -8) +2:4/0/texture_origin = Vector2i(0, -8) 2:4/0/terrain_set = 0 2:4/0/terrain = 0 2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -892,7 +892,7 @@ texture = ExtResource("1") 2:4/0/terrains_peering_bit/right_side = 0 3:4/size_in_atlas = Vector2i(1, 2) 3:4/0 = 0 -3:4/0/texture_offset = Vector2i(0, -8) +3:4/0/texture_origin = Vector2i(0, -8) 3:4/0/terrain_set = 0 3:4/0/terrain = 0 3:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -912,7 +912,7 @@ texture = ExtResource("1") 4:4/0/terrains_peering_bit/left_side = 0 5:4/size_in_atlas = Vector2i(1, 2) 5:4/0 = 0 -5:4/0/texture_offset = Vector2i(0, -8) +5:4/0/texture_origin = Vector2i(0, -8) 5:4/0/terrain_set = 0 5:4/0/terrain = 0 5:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -954,7 +954,7 @@ texture = ExtResource("1") 12:4/0/terrains_peering_bit/bottom_side = 1 13:4/size_in_atlas = Vector2i(1, 2) 13:4/0 = 0 -13:4/0/texture_offset = Vector2i(0, -8) +13:4/0/texture_origin = Vector2i(0, -8) 13:4/0/terrain_set = 0 13:4/0/terrain = 1 13:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -963,7 +963,7 @@ texture = ExtResource("1") 13:4/0/terrains_peering_bit/top_side = 1 14:4/size_in_atlas = Vector2i(1, 2) 14:4/0 = 0 -14:4/0/texture_offset = Vector2i(0, -8) +14:4/0/texture_origin = Vector2i(0, -8) 14:4/0/terrain_set = 0 14:4/0/terrain = 1 14:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -972,7 +972,7 @@ texture = ExtResource("1") 14:4/0/terrains_peering_bit/right_side = 1 15:4/size_in_atlas = Vector2i(1, 2) 15:4/0 = 0 -15:4/0/texture_offset = Vector2i(0, -8) +15:4/0/texture_origin = Vector2i(0, -8) 15:4/0/terrain_set = 0 15:4/0/terrain = 1 15:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -992,7 +992,7 @@ texture = ExtResource("1") 16:4/0/terrains_peering_bit/left_side = 1 17:4/size_in_atlas = Vector2i(1, 2) 17:4/0 = 0 -17:4/0/texture_offset = Vector2i(0, -8) +17:4/0/texture_origin = Vector2i(0, -8) 17:4/0/terrain_set = 0 17:4/0/terrain = 1 17:4/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -1140,7 +1140,7 @@ texture = ExtResource("1") 0:6/0/terrains_peering_bit/left_side = 0 1:6/size_in_atlas = Vector2i(1, 2) 1:6/0 = 0 -1:6/0/texture_offset = Vector2i(0, -8) +1:6/0/texture_origin = Vector2i(0, -8) 1:6/0/terrain_set = 0 1:6/0/terrain = 0 1:6/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -1178,7 +1178,7 @@ texture = ExtResource("1") 4:6/0/terrains_peering_bit/left_side = 0 5:6/size_in_atlas = Vector2i(1, 2) 5:6/0 = 0 -5:6/0/texture_offset = Vector2i(0, -8) +5:6/0/texture_origin = Vector2i(0, -8) 5:6/0/terrain_set = 0 5:6/0/terrain = 0 5:6/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -1216,7 +1216,7 @@ texture = ExtResource("1") 12:6/0/terrains_peering_bit/left_side = 1 13:6/size_in_atlas = Vector2i(1, 2) 13:6/0 = 0 -13:6/0/texture_offset = Vector2i(0, -8) +13:6/0/texture_origin = Vector2i(0, -8) 13:6/0/terrain_set = 0 13:6/0/terrain = 1 13:6/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -1254,7 +1254,7 @@ texture = ExtResource("1") 16:6/0/terrains_peering_bit/left_side = 1 17:6/size_in_atlas = Vector2i(1, 2) 17:6/0 = 0 -17:6/0/texture_offset = Vector2i(0, -8) +17:6/0/texture_origin = Vector2i(0, -8) 17:6/0/terrain_set = 0 17:6/0/terrain = 1 17:6/0/physics_layer_0/linear_velocity = Vector2(0, 0) @@ -1804,6 +1804,7 @@ texture = ExtResource("1") [resource] physics_layer_0/collision_layer = 1 +physics_layer_0/collision_mask = 0 terrain_set_0/mode = 0 terrain_set_0/terrain_0/name = "Colony Blue" terrain_set_0/terrain_0/color = Color(0, 0.384314, 0.721569, 1) diff --git a/Scenes/Test Scene.tscn b/Scenes/Test Scene.tscn index 15c839e..f090b43 100644 --- a/Scenes/Test Scene.tscn +++ b/Scenes/Test Scene.tscn @@ -1,16 +1,13 @@ -[gd_scene load_steps=8 format=3 uid="uid://0m5qkeqoo62l"] +[gd_scene load_steps=7 format=3 uid="uid://bvo0wgi38gdo0"] [ext_resource type="TileSet" uid="uid://bf1eb4aogv8ru" path="res://Assets/Tilesets/colony.tres" id="2"] [ext_resource type="Texture2D" uid="uid://dp4tdg3fxe5bf" path="res://Assets/Textures/color_cube.png" id="2_0flm2"] [ext_resource type="Script" path="res://Scripts/Player/PlayerMovement.gd" id="2_gw00d"] [ext_resource type="Texture2D" uid="uid://dx5k5qa1pwbfl" path="res://Assets/Textures/basic_enemy.png" id="4_4sn7h"] -[ext_resource type="Script" path="res://Scripts/Enemy/EnemyMovement.gd" id="4_kd58a"] +[ext_resource type="Script" path="res://Scripts/Enemy/EnemyLook.gd" id="5_k7y3d"] -[sub_resource type="RectangleShape2D" id="RectangleShape2D_6t40h"] -size = Vector2(5.5, 5.5) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_nxgkb"] -size = Vector2(6, 6) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_m15tu"] +size = Vector2(5, 5) [node name="Test Scene" type="Node2D"] @@ -20,19 +17,18 @@ scale = Vector2(0.898075, 0.866089) tile_set = ExtResource("2") format = 2 layer_0/name = "Ground" -layer_0/tile_data = PackedInt32Array(1114138, 262144, 1, 1048602, 0, 1, 983066, 0, 1, 1114137, 65536, 0, 1114136, 65536, 0, 1048603, 131072, 1, 1179675, 131072, 2, 1114139, 589824, 0, 983067, 131072, 1, 917531, 589824, 0, 1179674, 65536, 2, 917530, 262144, 0, 1179673, 1572864, 3, 917529, 65536, 2, 1179672, 65536, 2, 917528, 65536, 2, 1179671, 0, 2, 1114135, 655360, 3, 1048599, 131072, 1, 983063, 131072, 1, 917527, 196608, 0, 851995, 131072, 1, 851994, 196608, 3, 851993, 65536, 1, 851992, 196608, 3, 851991, 65536, 1, 917532, 327680, 2, 917533, 458752, 1, 983069, 327680, 1, 1048605, 327680, 1, 1114141, 458752, 2, 1114140, 327680, 2, 917525, 0, 0, 983061, 1769472, 1, 1048597, 0, 1, 1114133, 0, 2, 1114134, 65536, 2, 786456, 196608, 3, 786457, 196608, 2, 720921, 262144, 3, 720920, 262144, 3, 720919, 262144, 2, 655383, 262144, 2, 655382, 0, 1, 589848, 65536, 1, 589849, 196608, 2, 655385, 65536, 1, 655384, 262144, 3, 655386, 65536, 1, 720922, 65536, 1, 589850, 65536, 1, 524313, 65536, 1, 524312, 196608, 2, 524311, 262144, 1, 524310, 65536, 0, 589846, 262144, 0, 589847, 65536, 1, 524314, 196608, 1, 655387, 131072, 1, 589851, 131072, 1, 458776, 1638400, 1, 458777, 65536, 0, 458778, 131072, 0, 524315, 131072, 0, 458775, 0, 0, 720916, 983040, 3, 655380, 983040, 1, 589844, 917504, 1, 524308, 917504, 1, 458772, 983040, 0, 458771, 851968, 1, 524307, 1048576, 2, 589843, 851968, 1, 655379, 1048576, 3, 720915, 851968, 1, 589845, 0, 2, 524309, 0, 0, 524306, 786432, 1, 458770, 1048576, 0, 589842, 786432, 1, 655378, 1048576, 1, 655377, 851968, 0, 458769, 851968, 2, 720914, 851968, 1, 720913, 983040, 2, 655376, 851968, 0, 589839, 917504, 1, 655375, 1441792, 3, 524303, 917504, 1, 524302, 786432, 1, 589838, 786432, 1, 458768, 851968, 2, 458767, 983040, 0, 393233, 1048576, 1, 393234, 983040, 2, 393235, 851968, 1, 393236, 983040, 3, 458773, 851968, 2, 720917, 2031616, 2, 655381, 917504, 0, 393237, 851968, 1, 786452, 851968, 1, 786453, 2031616, 3, 720918, 2097152, 2, 786454, 2097152, 3, 851990, 0, 1, 851989, 917504, 2, 851988, 983040, 0, 851987, 983040, 2, 786451, 983040, 2, 458774, 917504, 2, 393238, 983040, 0, 393239, 851968, 2, 393240, 1638400, 0, 393241, 851968, 2, 393242, 917504, 2, 327706, 917504, 0, 327705, 851968, 0, 327704, 851968, 0, 327703, 851968, 0, 327702, 851968, 0, 327701, 851968, 0, 327700, 851968, 0, 327699, 851968, 0, 327698, 983040, 1, 786455, 196608, 3, 786450, 851968, 1, 917522, 786432, 2, 917524, 917504, 1, 917523, 1048576, 0, 1048596, 917504, 2, 983059, 786432, 1, 1048595, 786432, 2, 851986, 1048576, 0, 851985, 786432, 2, 786449, 1048576, 0, 786448, 786432, 2, 720912, 1048576, 0, 720911, 786432, 2, 655374, 786432, 2, 458766, 786432, 1, 393231, 851968, 0, 393232, 851968, 0, 327697, 786432, 1, 327694, 917504, 1, 327693, 1310720, 0, 262157, 786432, 1, 262158, 983040, 0, 393230, 1441792, 3, 393229, 786432, 2, 262159, 851968, 2, 262160, 851968, 2, 262161, 1048576, 0, 196625, 851968, 1, 196624, 1048576, 3, 196623, 851968, 1, 196622, 1048576, 1, 262162, 917504, 1, 196626, 983040, 0, 196627, 851968, 2, 196628, 851968, 2, 196629, 917504, 2, 131093, 917504, 0, 131092, 851968, 0, 131091, 851968, 0, 131090, 851968, 0, 131089, 851968, 0, 131088, 851968, 0, 131086, 786432, 0, 131087, 851968, 0, 196621, 786432, 0, 327692, 1114112, 2, 327691, 1114112, 2, 262154, 917504, 0, 327690, 1376256, 0, 393226, 917504, 2, 262153, 851968, 0, 327689, 851968, 1, 393225, 851968, 2, 393224, 786432, 2, 327688, 786432, 1, 262152, 786432, 0, 589855, 0, 0, 655391, 0, 2, 589856, 65536, 0, 655393, 131072, 2, 589857, 131072, 0, 786464, 851968, 1, 786463, 1048576, 3, 786465, 917504, 1, 917537, 917504, 2, 852001, 917504, 1, 852000, 983040, 2, 851999, 1048576, 0, 917535, 786432, 2, 917536, 851968, 2, 720927, 851968, 0, 720929, 917504, 0, 720928, 1572864, 1, 655392, 1572864, 0, 786462, 851968, 1, 786461, 983040, 3, 786460, 1769472, 0, 720924, 786432, 0, 720925, 851968, 0, 720926, 851968, 0, 851996, 786432, 2, 851997, 851968, 2, 851998, 851968, 2, 786458, 65536, 1, 786459, 1703936, 0, 720923, 131072, 1, 983062, 65536, 1, 1048598, 65536, 1, 983060, 1703936, 1, 917526, 262144, 1, 1245209, 1572864, 4, 1245208, 786432, 0, 1310744, 786432, 1, 1310745, 851968, 1, 1310746, 917504, 1, 1245210, 917504, 0, 1376282, 983040, 1, 1376281, 851968, 1, 1376280, 1048576, 1, 1441816, 983040, 3, 1441817, 851968, 1, 1441818, 851968, 1, 1507353, 851968, 1, 1507352, 1048576, 0, 1507354, 983040, 0, 1376279, 851968, 0, 1441815, 1048576, 2, 1507351, 851968, 2, 1572888, 786432, 1, 1572889, 851968, 1, 1572890, 917504, 1, 1441819, 1048576, 2, 1376283, 851968, 0, 1376278, 786432, 0, 1441814, 1769472, 3, 1507350, 786432, 2, 1638424, 786432, 2, 1638425, 1638400, 3, 1638426, 917504, 2, 1507349, 131072, 2, 1441813, 1703936, 3, 1376277, 131072, 0, 1376276, 65536, 0, 1376275, 65536, 0, 1441811, 65536, 1, 1507347, 2293760, 0, 1507348, 65536, 2, 1441812, 65536, 1, 1376286, 65536, 0, 1441822, 262144, 3, 1441823, 65536, 1, 1507358, 65536, 2, 1376287, 65536, 0, 1507359, 2228224, 0, 1507360, 2293760, 0, 1441824, 196608, 1, 1376288, 131072, 0, 1376274, 0, 0, 1441810, 262144, 1, 1507346, 2228224, 0, 1703960, 0, 0, 1703961, 1638400, 4, 1703962, 131072, 0, 1769498, 131072, 1, 1769497, 65536, 1, 1769496, 0, 1, 1835032, 0, 1, 1835033, 262144, 3, 1900569, 65536, 1, 1835034, 131072, 1, 1900570, 131072, 1, 1900568, 0, 1, 1572884, 917504, 0, 1572883, 2293760, 1, 1572882, 2228224, 1, 1638418, 851968, 1, 1703954, 851968, 2, 1638419, 851968, 1, 1638420, 917504, 1, 1703956, 917504, 2, 1703955, 851968, 2, 1703953, 786432, 2, 1638417, 786432, 1, 1572881, 786432, 0, 1572894, 786432, 0, 1638430, 786432, 2, 1638432, 851968, 2, 1638433, 917504, 2, 1638431, 851968, 2, 1572895, 2228224, 1, 1572896, 2293760, 1, 1572897, 917504, 0, 1507345, 0, 2, 1441809, 0, 0, 1507361, 131072, 2, 1441825, 131072, 0, 2097178, 2228224, 3, 2031641, 65536, 1, 1966104, 0, 1, 2162714, 131072, 2, 2031642, 2228224, 2, 1966106, 131072, 1, 2162713, 65536, 2, 2097177, 65536, 1, 1966105, 65536, 1, 2162712, 0, 2, 2097176, 2424832, 3, 2031640, 2424832, 2, 2162711, 917504, 2, 2097175, 2359296, 3, 2031639, 2359296, 2, 1966103, 917504, 0, 1966102, 851968, 0, 1966101, 851968, 0, 1966100, 851968, 0, 1966099, 786432, 0, 2162710, 851968, 2, 2097174, 1048576, 2, 2031638, 1048576, 3, 2162709, 851968, 2, 2097173, 1048576, 2, 2031637, 1048576, 3, 2162708, 851968, 2, 2097172, 983040, 2, 2031636, 851968, 1, 2162707, 786432, 2, 2097171, 786432, 1, 2031635, 786432, 1, 1966107, 786432, 0, 2031643, 2293760, 2, 2031644, 851968, 1, 2097180, 851968, 1, 2097181, 983040, 2, 2162718, 851968, 2, 2162719, 917504, 2, 2097183, 917504, 1, 2031647, 917504, 1, 1966111, 917504, 0, 2097182, 983040, 3, 2031646, 851968, 1, 1966110, 851968, 0, 2162717, 851968, 2, 2031645, 851968, 1, 1966109, 851968, 0, 2162716, 851968, 2, 1966108, 851968, 0, 2162715, 786432, 2, 2097179, 2293760, 3, 1376285, 0, 0, 1441821, 1769472, 4, 1376284, 917504, 0, 1441820, 1703936, 4, 1507355, 851968, 2, 1507356, 917504, 2, 1507357, 0, 2) +layer_0/tile_data = PackedInt32Array(1114138, 262144, 1, 1048602, 0, 1, 983066, 0, 1, 1114137, 65536, 0, 1114136, 65536, 0, 1048603, 131072, 1, 1179675, 131072, 2, 1114139, 589824, 0, 983067, 131072, 1, 917531, 589824, 0, 1179674, 65536, 2, 917530, 262144, 0, 1179673, 1572864, 3, 917529, 65536, 2, 1179672, 65536, 2, 917528, 65536, 2, 1179671, 0, 2, 1114135, 655360, 3, 1048599, 131072, 1, 983063, 131072, 1, 917527, 196608, 0, 851995, 131072, 1, 851994, 196608, 3, 851993, 65536, 1, 851992, 196608, 3, 851991, 65536, 1, 917532, 327680, 2, 917533, 458752, 1, 983069, 327680, 1, 1048605, 327680, 1, 1114141, 458752, 2, 1114140, 327680, 2, 917525, 0, 0, 983061, 1769472, 1, 1048597, 0, 1, 1114133, 0, 2, 1114134, 65536, 2, 786456, 196608, 3, 786457, 196608, 2, 720921, 262144, 3, 720920, 262144, 3, 720919, 262144, 2, 655383, 262144, 2, 655382, 0, 1, 589848, 65536, 1, 589849, 196608, 2, 655385, 65536, 1, 655384, 262144, 3, 655386, 65536, 1, 720922, 65536, 1, 589850, 65536, 1, 524313, 65536, 1, 524312, 196608, 2, 524311, 262144, 1, 524310, 65536, 0, 589846, 262144, 0, 589847, 65536, 1, 524314, 196608, 1, 655387, 131072, 1, 589851, 131072, 1, 458776, 1638400, 1, 458777, 65536, 0, 458778, 131072, 0, 524315, 131072, 0, 458775, 0, 0, 720916, 983040, 3, 655380, 983040, 1, 589844, 917504, 1, 524308, 917504, 1, 458772, 983040, 0, 458771, 851968, 1, 524307, 1048576, 2, 589843, 851968, 1, 655379, 1048576, 3, 720915, 851968, 1, 589845, 0, 2, 524309, 0, 0, 524306, 786432, 1, 458770, 1048576, 0, 589842, 786432, 1, 655378, 1048576, 1, 655377, 851968, 0, 458769, 851968, 2, 720914, 851968, 1, 720913, 983040, 2, 655376, 851968, 0, 589839, 917504, 1, 655375, 1441792, 3, 524303, 917504, 1, 524302, 786432, 1, 589838, 786432, 1, 458768, 851968, 2, 458767, 983040, 0, 393233, 1048576, 1, 393234, 983040, 2, 393235, 851968, 1, 393236, 983040, 3, 458773, 851968, 2, 720917, 2031616, 2, 655381, 917504, 0, 393237, 851968, 1, 786452, 851968, 1, 786453, 2031616, 3, 720918, 2097152, 2, 786454, 2097152, 3, 851990, 0, 1, 851989, 917504, 2, 851988, 983040, 0, 851987, 983040, 2, 786451, 983040, 2, 458774, 917504, 2, 393238, 983040, 0, 393239, 851968, 2, 393240, 1638400, 0, 393241, 851968, 2, 393242, 917504, 2, 327706, 917504, 0, 327705, 851968, 0, 327704, 851968, 0, 327703, 851968, 0, 327702, 851968, 0, 327701, 851968, 0, 327700, 851968, 0, 327699, 851968, 0, 327698, 983040, 1, 786455, 196608, 3, 786450, 851968, 1, 917522, 786432, 2, 917524, 917504, 1, 917523, 1048576, 0, 1048596, 917504, 2, 983059, 786432, 1, 1048595, 786432, 2, 851986, 1048576, 0, 851985, 786432, 2, 786449, 1048576, 0, 786448, 786432, 2, 720912, 1048576, 0, 720911, 786432, 2, 655374, 786432, 2, 458766, 786432, 1, 393231, 983040, 1, 393232, 851968, 0, 327697, 786432, 1, 327694, 851968, 1, 327693, 1310720, 0, 262157, 786432, 1, 262158, 851968, 1, 393230, 1048576, 0, 393229, 786432, 2, 262159, 983040, 0, 262160, 851968, 2, 262161, 1048576, 0, 196625, 851968, 1, 196624, 1048576, 3, 196623, 851968, 1, 196622, 1048576, 1, 262162, 917504, 1, 196626, 983040, 0, 196627, 851968, 2, 196628, 851968, 2, 196629, 917504, 2, 131093, 917504, 0, 131092, 851968, 0, 131091, 851968, 0, 131090, 851968, 0, 131089, 851968, 0, 131088, 851968, 0, 131086, 786432, 0, 131087, 851968, 0, 196621, 786432, 0, 327692, 1114112, 2, 327691, 1114112, 2, 262154, 917504, 0, 327690, 1376256, 0, 393226, 917504, 2, 262153, 851968, 0, 327689, 851968, 1, 393225, 851968, 2, 393224, 786432, 2, 327688, 786432, 1, 262152, 786432, 0, 589855, 0, 0, 655391, 0, 2, 589856, 65536, 0, 655393, 131072, 2, 589857, 131072, 0, 786464, 851968, 1, 786463, 1048576, 3, 786465, 917504, 1, 917537, 917504, 2, 852001, 917504, 1, 852000, 983040, 2, 851999, 1048576, 0, 917535, 786432, 2, 917536, 851968, 2, 720927, 851968, 0, 720929, 917504, 0, 720928, 1572864, 1, 655392, 1572864, 0, 786462, 851968, 1, 786461, 983040, 3, 786460, 1769472, 0, 720924, 786432, 0, 720925, 851968, 0, 720926, 851968, 0, 851996, 786432, 2, 851997, 851968, 2, 851998, 851968, 2, 786458, 65536, 1, 786459, 1703936, 0, 720923, 131072, 1, 983062, 65536, 1, 1048598, 65536, 1, 983060, 1703936, 1, 917526, 262144, 1, 1245209, 1572864, 4, 1245208, 786432, 0, 1310744, 786432, 1, 1310745, 851968, 1, 1310746, 917504, 1, 1245210, 917504, 0, 1376282, 983040, 1, 1376281, 851968, 1, 1376280, 1048576, 1, 1441816, 983040, 3, 1441817, 851968, 1, 1441818, 851968, 1, 1507353, 851968, 1, 1507352, 1048576, 0, 1507354, 983040, 0, 1376279, 851968, 0, 1441815, 1048576, 2, 1507351, 851968, 2, 1572888, 786432, 1, 1572889, 851968, 1, 1572890, 917504, 1, 1441819, 1048576, 2, 1376283, 851968, 0, 1376278, 786432, 0, 1441814, 1769472, 3, 1507350, 786432, 2, 1638424, 786432, 2, 1638425, 1638400, 3, 1638426, 917504, 2, 1507349, 131072, 2, 1441813, 1703936, 3, 1376277, 131072, 0, 1376276, 65536, 0, 1376275, 65536, 0, 1441811, 65536, 1, 1507347, 2293760, 0, 1507348, 65536, 2, 1441812, 65536, 1, 1376286, 65536, 0, 1441822, 262144, 3, 1441823, 65536, 1, 1507358, 65536, 2, 1376287, 65536, 0, 1507359, 2228224, 0, 1507360, 2293760, 0, 1441824, 196608, 1, 1376288, 131072, 0, 1376274, 0, 0, 1441810, 262144, 1, 1507346, 2228224, 0, 1703960, 0, 0, 1703961, 1638400, 4, 1703962, 131072, 0, 1769498, 131072, 1, 1769497, 65536, 1, 1769496, 0, 1, 1835032, 0, 1, 1835033, 262144, 3, 1900569, 65536, 1, 1835034, 131072, 1, 1900570, 131072, 1, 1900568, 0, 1, 1572884, 917504, 0, 1572883, 2293760, 1, 1572882, 2228224, 1, 1638418, 851968, 1, 1703954, 851968, 2, 1638419, 851968, 1, 1638420, 917504, 1, 1703956, 917504, 2, 1703955, 851968, 2, 1703953, 786432, 2, 1638417, 786432, 1, 1572881, 786432, 0, 1572894, 786432, 0, 1638430, 786432, 2, 1638432, 851968, 2, 1638433, 917504, 2, 1638431, 851968, 2, 1572895, 2228224, 1, 1572896, 2293760, 1, 1572897, 917504, 0, 1507345, 0, 2, 1441809, 0, 0, 1507361, 131072, 2, 1441825, 131072, 0, 2097178, 2228224, 3, 2031641, 65536, 1, 1966104, 0, 1, 2162714, 131072, 2, 2031642, 2228224, 2, 1966106, 131072, 1, 2162713, 65536, 2, 2097177, 65536, 1, 1966105, 65536, 1, 2162712, 0, 2, 2097176, 2424832, 3, 2031640, 2424832, 2, 2162711, 917504, 2, 2097175, 2359296, 3, 2031639, 2359296, 2, 1966103, 917504, 0, 1966102, 851968, 0, 1966101, 851968, 0, 1966100, 851968, 0, 1966099, 786432, 0, 2162710, 851968, 2, 2097174, 1048576, 2, 2031638, 1048576, 3, 2162709, 851968, 2, 2097173, 1048576, 2, 2031637, 1048576, 3, 2162708, 851968, 2, 2097172, 983040, 2, 2031636, 851968, 1, 2162707, 786432, 2, 2097171, 786432, 1, 2031635, 786432, 1, 1966107, 786432, 0, 2031643, 2293760, 2, 2031644, 851968, 1, 2097180, 851968, 1, 2097181, 983040, 2, 2162718, 851968, 2, 2162719, 917504, 2, 2097183, 917504, 1, 2031647, 917504, 1, 1966111, 917504, 0, 2097182, 983040, 3, 2031646, 851968, 1, 1966110, 851968, 0, 2162717, 851968, 2, 2031645, 851968, 1, 1966109, 851968, 0, 2162716, 851968, 2, 1966108, 851968, 0, 2162715, 786432, 2, 2097179, 2293760, 3, 1376285, 0, 0, 1441821, 1769472, 4, 1376284, 917504, 0, 1441820, 1703936, 4, 1507355, 851968, 2, 1507356, 917504, 2, 1507357, 0, 2, 327695, 917504, 1) [node name="Player" type="CharacterBody2D" parent="."] +position = Vector2(203, 60) +collision_layer = 2 script = ExtResource("2_gw00d") speed = 100 [node name="Sprite2D" type="Sprite2D" parent="Player"] -position = Vector2(149, 86) texture = ExtResource("2_0flm2") [node name="Camera2D" type="Camera2D" parent="Player"] -position = Vector2(149, 86) -current = true zoom = Vector2(8, 8) position_smoothing_enabled = true drag_horizontal_enabled = true @@ -41,16 +37,18 @@ editor_draw_limits = true editor_draw_drag_margin = true [node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] -position = Vector2(149, 86) -shape = SubResource("RectangleShape2D_6t40h") +shape = SubResource("RectangleShape2D_m15tu") -[node name="BasicEnemy" type="CharacterBody2D" parent="."] -script = ExtResource("4_kd58a") - -[node name="CollisionShape2D" type="CollisionShape2D" parent="BasicEnemy"] -position = Vector2(206, 65) -shape = SubResource("RectangleShape2D_nxgkb") - -[node name="Sprite2D" type="Sprite2D" parent="BasicEnemy"] -position = Vector2(206, 65) +[node name="Sprite2D" type="Sprite2D" parent="." node_paths=PackedStringArray("ray")] +z_index = 1 +position = Vector2(237, 46) +rotation = 2.04581 texture = ExtResource("4_4sn7h") +script = ExtResource("5_k7y3d") +ray = NodePath("RayCast2D") +debug_vision = true + +[node name="RayCast2D" type="RayCast2D" parent="Sprite2D"] +target_position = Vector2(15, 0) +collision_mask = 3 +hit_from_inside = true diff --git a/Scripts/Enemy/EnemyLook.gd b/Scripts/Enemy/EnemyLook.gd new file mode 100644 index 0000000..5b74c3a --- /dev/null +++ b/Scripts/Enemy/EnemyLook.gd @@ -0,0 +1,108 @@ +extends Node2D + +@export_group("Movement Properties") +@export var speed = 25 +@export var turn_speed = 25 + +@export_group("Vision Properties") +@export var ray : RayCast2D +@export_flags_2d_physics var player_collision_layer := 2 +@export var max_view_distance := 50 +@export_range(0.0, 360.0) var angle_cone_of_vision : float = 120 +@export_range(0, 72) var sweeping_steps : int = 24 +@export var debug_vision := false + +var sees_player : bool +var player_positions : Array + +func _ready(): + # Set Raycast into view Direction + ray.target_position = Vector2(max_view_distance, 0) + pass + +func view(): + # Swipe the Raycast instead of using a lot to get better performance + + # Set Raycast to starting position + ray.rotation_degrees = -angle_cone_of_vision / 2 + + # Create Array to Store Angles of Hits + var hit_angles : Array + + # Clear Player Positions Array + player_positions.clear() + + for step in sweeping_steps + 1: + # Check Ray + ray.force_raycast_update() + if ray.is_colliding(): + # Get Collider + var collider = ray.get_collider() + var collider_class = collider.get_class() + var collision_layer : int + + # Get Collision Layer + if collider_class == "TileMap": + collider = collider as TileMap + collision_layer = collider.tile_set.get_physics_layer_collision_layer(0) + else: + collision_layer = collider.get_collision_layer() + + # Checking Collision Layer + if collision_layer & player_collision_layer > 0: + hit_angles.append(ray.rotation_degrees) + player_positions.append(to_local(ray.get_collision_point())) + # Rotate Ray + ray.rotation_degrees += angle_cone_of_vision / sweeping_steps + return hit_angles + +func rotate_to_player(delta : float): + + # Get All Angles at which the Player can be seen + var hit_angles = view() + + # If The Player cant be seen, return and do nothing + if hit_angles.size() <= 0: + sees_player = false + return + sees_player = true + + # Calculate Average Angle Of Player + var average_angle : float + for angle in hit_angles: + average_angle += angle + average_angle /= hit_angles.size() + + # Rotate towards Player, but limit it by rotation speed + self.rotation_degrees += clampf(average_angle, -2 * PI * delta * turn_speed, 2 * PI * delta * turn_speed) + + pass + +func _physics_process(delta): + rotate_to_player(delta) + pass + +func _process(delta): + if debug_vision: + queue_redraw() + pass + +func _draw(): + # Draw a Debug Arc in case that Debug Vision is enabled + if debug_vision: + + # Draw All Ray Positions + var angle = -angle_cone_of_vision / 2 + for step in sweeping_steps + 1: + self.draw_line(Vector2(), Vector2(max_view_distance,0).rotated(deg_to_rad(angle)), Color.DARK_RED, 0.5, false) + angle += angle_cone_of_vision / sweeping_steps + + # Draw Ray Arc + self.draw_arc(Vector2(), max_view_distance, deg_to_rad(-angle_cone_of_vision / 2), deg_to_rad(angle_cone_of_vision / 2), sweeping_steps + 1, Color.RED, 0.5, false) + + # Draw A Circle Around the Player if hes seen + if sees_player: + for pos in player_positions: + self.draw_circle(pos, 4, Color.ORANGE_RED) + pass + diff --git a/Scripts/Enemy/EnemyMovement.gd b/Scripts/Enemy/EnemyMovement.gd deleted file mode 100644 index febcb84..0000000 --- a/Scripts/Enemy/EnemyMovement.gd +++ /dev/null @@ -1,19 +0,0 @@ -extends CharacterBody2D - -@export var speed = 25 - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _physics_process(delta): - var sprite = self.get_child(1) - self.velocity = Vector2(cos(sprite.get_rotation() - PI / 2), sin(sprite.get_rotation() - PI / 2)).normalized() * speed - - - if self.move_and_slide(): - sprite.rotate(PI) - - diff --git a/project.godot b/project.godot index 92a789a..e0081ca 100644 --- a/project.godot +++ b/project.godot @@ -65,6 +65,12 @@ do_shake={ ] } +[layer_names] + +2d_physics/layer_1="Map" +2d_physics/layer_2="Player" +2d_physics/layer_3="Enemys" + [physics] common/enable_pause_aware_picking=true