diff --git a/metroidvania/Scenes/Enemies/CrawlingEnemy.gd b/metroidvania/Scenes/Enemies/CrawlingEnemy.gd index 31e9767..999cc5e 100644 --- a/metroidvania/Scenes/Enemies/CrawlingEnemy.gd +++ b/metroidvania/Scenes/Enemies/CrawlingEnemy.gd @@ -19,7 +19,7 @@ func _physics_process(delta): floorCast.rotation_degrees = -MAX_SPEED * 10 * WALKING_DIRECTION * delta if floorCast.is_colliding(): global_position = floorCast.get_collision_point() - var normal = wallCast.get_collision_normal() + var normal = floorCast.get_collision_normal() rotation = normal.rotated(deg2rad(90)).angle() else: rotation_degrees += 20 * WALKING_DIRECTION diff --git a/metroidvania/Scenes/Enemies/CrawlingEnemy.tscn b/metroidvania/Scenes/Enemies/CrawlingEnemy.tscn index 6bf3704..db8ff68 100644 --- a/metroidvania/Scenes/Enemies/CrawlingEnemy.tscn +++ b/metroidvania/Scenes/Enemies/CrawlingEnemy.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://Assets/Enemies/CrawlingEnemy.png" type="Texture" id=2] [ext_resource path="res://Scenes/Enemies/CrawlingEnemy.gd" type="Script" id=3] -[sub_resource type="Animation" id=3] +[sub_resource type="Animation" id=1] resource_name = "Animate" length = 0.8 loop = true @@ -18,13 +18,13 @@ tracks/0/keys = { "times": PoolRealArray( 0, 0.2, 0.4, 0.6 ), "transitions": PoolRealArray( 1, 1, 1, 1 ), "update": 1, -"values": [ 0, 1, 1, 1 ] +"values": [ 0, 1, 2, 3 ] } -[sub_resource type="RectangleShape2D" id=1] +[sub_resource type="RectangleShape2D" id=2] extents = Vector2( 7, 3 ) -[sub_resource type="RectangleShape2D" id=2] +[sub_resource type="RectangleShape2D" id=3] extents = Vector2( 5, 2 ) [node name="CrawlingEnemy" instance=ExtResource( 1 )] @@ -34,24 +34,24 @@ script = ExtResource( 3 ) position = Vector2( 0, -8 ) texture = ExtResource( 2 ) hframes = 4 -frame = 1 +frame = 3 [node name="AnimationPlayer" parent="." index="2"] autoplay = "Animate" -anims/Animate = SubResource( 3 ) +anims/Animate = SubResource( 1 ) [node name="Collider" parent="Hurtbox" index="0"] position = Vector2( 0, -3 ) -shape = SubResource( 1 ) +shape = SubResource( 2 ) [node name="Collider" parent="Hitbox" index="0"] position = Vector2( 0, -2 ) -shape = SubResource( 2 ) +shape = SubResource( 3 ) [node name="FloorCast" type="RayCast2D" parent="." index="6"] position = Vector2( 0, -4 ) enabled = true -cast_to = Vector2( 0, 4 ) +cast_to = Vector2( 0, 8 ) collision_mask = 2 [node name="WallCast" type="RayCast2D" parent="." index="7"] @@ -61,5 +61,4 @@ cast_to = Vector2( 4, 0 ) collision_mask = 2 [editable path="Hurtbox"] - [editable path="Hitbox"] diff --git a/metroidvania/Scenes/World/World.tscn b/metroidvania/Scenes/World/World.tscn index b7e9bc9..32fc948 100644 --- a/metroidvania/Scenes/World/World.tscn +++ b/metroidvania/Scenes/World/World.tscn @@ -43,7 +43,12 @@ position = Vector2( 224, 88 ) [node name="PlantEnemy" parent="." instance=ExtResource( 9 )] position = Vector2( 136, 128 ) +[node name="PlantEnemy2" parent="." instance=ExtResource( 9 )] +position = Vector2( 402.842, 16 ) +rotation = 3.14159 + [node name="CrawlingEnemy" parent="." instance=ExtResource( 10 )] position = Vector2( 72, 160 ) [editable path="Player"] +[editable path="Player/Hurtbox"] diff --git a/metroidvania/project.godot b/metroidvania/project.godot index 471a4a1..3212a3a 100644 --- a/metroidvania/project.godot +++ b/metroidvania/project.godot @@ -120,5 +120,6 @@ pause={ [rendering] -quality/2d/use_pixel_snap=true +2d/snapping/use_gpu_pixel_snap=true environment/default_environment="res://default_env.tres" +quality/2d/use_pixel_snap=true