Add pillar walls, fix AI going through walls when repositioning

This commit is contained in:
Raxki 2024-09-20 17:22:44 -04:00
parent 2dd0679631
commit b8d3cb02af
10 changed files with 206 additions and 7 deletions

View file

@ -283,12 +283,12 @@ collision_layer = 2
collision_mask = 10
[node name="Collider" type="CollisionShape2D" parent="Hitbox"]
visible = false
position = Vector2(0, -14)
shape = SubResource("CapsuleShape2D_vm050")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
[node name="MovementCollider" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(-0.5, -1)
shape = SubResource("RectangleShape2D_bdqvd")

View file

@ -118,14 +118,22 @@ func _on_hurt_state_exited():
func _on_hurt_reposition_state_entered():
var facing_direction = attacked_from * -1
$MovementCollider.set_deferred("disabled", true)
set_collision_layer_value(5, true)
set_collision_layer_value(1, false)
set_collision_mask_value(5, true)
set_collision_mask_value(1, false)
#$MovementCollider.set_deferred("disabled", true)
set_animation_direction(facing_direction)
anim_playback.travel("hurt")
velocity = attacked_from * KNOCKBACK_REPOSITION_POWER * -1
func _on_hurt_reposition_state_exited():
velocity = Vector2.ZERO
$MovementCollider.set_deferred("disabled", false)
set_collision_layer_value(5, false)
set_collision_layer_value(1, true)
set_collision_mask_value(5, false)
set_collision_mask_value(1, true)
#$MovementCollider.set_deferred("disabled", false)
hit_counter = 0
func _on_animation_tree_animation_finished(anim_name):

BIN
world/long wood pillar .png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dywy1nhojkpuq"
path="res://.godot/imported/long wood pillar .png-2ae92e566dd29779fff88b39b2055e5e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://world/long wood pillar .png"
dest_files=["res://.godot/imported/long wood pillar .png-2ae92e566dd29779fff88b39b2055e5e.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

32
world/pillar.tscn Normal file
View file

@ -0,0 +1,32 @@
[gd_scene load_steps=4 format=3 uid="uid://c503u0i421w34"]
[ext_resource type="Texture2D" uid="uid://d0aw0q6fvgk1o" path="res://world/wood pillar.png" id="1_wjgo2"]
[ext_resource type="Texture2D" uid="uid://dywy1nhojkpuq" path="res://world/long wood pillar .png" id="2_q108x"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_nsmbw"]
size = Vector2(8, 24)
[node name="Node2D" type="Node2D"]
[node name="StaticBody2D" type="StaticBody2D" parent="."]
texture_filter = 1
position = Vector2(0, -22)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
texture_filter = 1
position = Vector2(0, 10)
shape = SubResource("RectangleShape2D_nsmbw")
[node name="WoodPillar" type="Sprite2D" parent="."]
visible = false
y_sort_enabled = true
texture_filter = 1
position = Vector2(0, -22)
texture = ExtResource("1_wjgo2")
[node name="LongWoodPillar" type="Sprite2D" parent="."]
texture_filter = 1
position = Vector2(0, -32)
texture = ExtResource("2_q108x")

BIN
world/walls.png (Stored with Git LFS) Normal file

Binary file not shown.

34
world/walls.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dc12iaho4b8yl"
path="res://.godot/imported/walls.png-a96ddd85a7a29b3ff8651db1d6479999.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://world/walls.png"
dest_files=["res://.godot/imported/walls.png-a96ddd85a7a29b3ff8651db1d6479999.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

BIN
world/wood pillar.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d0aw0q6fvgk1o"
path="res://.godot/imported/wood pillar.png-458c768add8f3021bafd77705155c1df.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://world/wood pillar.png"
dest_files=["res://.godot/imported/wood pillar.png-458c768add8f3021bafd77705155c1df.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

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://bxuxjqxxqy7ce"]
[gd_scene load_steps=9 format=3 uid="uid://bxuxjqxxqy7ce"]
[ext_resource type="PackedScene" uid="uid://di21xheryhp0k" path="res://Hiro/hiro_player.tscn" id="1_c1gpq"]
[ext_resource type="PackedScene" uid="uid://b8sfype1vx5ad" path="res://Nem/nem_npc.tscn" id="1_sqt7d"]
@ -6,18 +6,63 @@
[ext_resource type="Texture2D" uid="uid://b40la2vyf4rn6" path="res://world/Fighting Dojo BG.png" id="4_elb6q"]
[ext_resource type="PackedScene" uid="uid://dd2km6qhpdicx" path="res://Hiro/hiro_ai.tscn" id="5_r7nw4"]
[ext_resource type="PackedScene" uid="uid://bakb5a7xe4qby" path="res://Reed/reed_player.tscn" id="6_cn8e2"]
[ext_resource type="Texture2D" uid="uid://dc12iaho4b8yl" path="res://world/walls.png" id="7_pp5dn"]
[ext_resource type="PackedScene" uid="uid://c503u0i421w34" path="res://world/pillar.tscn" id="8_mxq55"]
[node name="Node2D" type="Node2D"]
y_sort_enabled = true
[node name="FightingDojoBg" type="Sprite2D" parent="."]
[node name="MapElements" type="Node2D" parent="."]
y_sort_enabled = true
[node name="FightingDojoBg" type="Sprite2D" parent="MapElements"]
z_index = -5
texture_filter = 1
position = Vector2(136, 148)
texture = ExtResource("4_elb6q")
metadata/_edit_lock_ = true
[node name="LongWoodPillar" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(48, 239)
[node name="LongWoodPillar2" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(48, 159)
[node name="LongWoodPillar3" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(96, 120)
[node name="LongWoodPillar4" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(224, 159)
[node name="LongWoodPillar5" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(224, 239)
[node name="LongWoodPillar6" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(176, 120)
[node name="LongWoodPillar7" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(96, 280)
[node name="LongWoodPillar8" parent="MapElements" instance=ExtResource("8_mxq55")]
y_sort_enabled = true
position = Vector2(176, 279)
[node name="Walls" type="Sprite2D" parent="MapElements"]
z_index = 1
texture_filter = 1
position = Vector2(137, 199)
texture = ExtResource("7_pp5dn")
[node name="HiroPlayer" parent="." instance=ExtResource("1_c1gpq")]
position = Vector2(92, 178)
speed = 80
[node name="ReedPlayer" parent="." instance=ExtResource("6_cn8e2")]
position = Vector2(176, 178)
@ -26,12 +71,14 @@ position = Vector2(176, 178)
position = Vector2(138, 112)
[node name="BG Collissions" type="StaticBody2D" parent="."]
y_sort_enabled = true
z_index = 2
collision_layer = 17
collision_mask = 17
[node name="Floor Collission" type="CollisionPolygon2D" parent="BG Collissions"]
position = Vector2(-1341, -243)
scale = Vector2(8.83789, 4.22585)
polygon = PackedVector2Array(157.843, 76.9076, 161.464, 75.961, 172.213, 75.7244, 176.513, 76.9076, 179.22, 82.4429, 180.012, 85.7558, 180.238, 91.9084, 180.012, 107.053, 178.549, 113.823, 176.739, 116.426, 175.042, 118.083, 169.497, 118.319, 169.497, 123.525, 164.745, 123.525, 164.858, 118.319, 158.975, 117.846, 157.504, 116.663, 155.806, 114.533, 154.109, 108.617, 154.109, 94.4188, 154.222, 83.2968, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 154.222, 83.7701, 155.92, 79.9839)
polygon = PackedVector2Array(157.843, 76.9076, 161.464, 75.961, 172.213, 75.7244, 176.513, 76.9076, 179.22, 82.4429, 180.012, 85.7558, 180.36, 93.9456, 180.247, 114.06, 179.341, 117.373, 177.871, 119.739, 174.929, 120.922, 169.497, 120.922, 169.497, 123.525, 164.745, 123.525, 164.632, 120.922, 159.201, 120.922, 156.372, 120.213, 154.901, 117.373, 154.109, 114.533, 153.883, 94.4189, 153.883, 84.0068, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 153.883, 84.0068, 155.92, 79.9839)
[node name="StateChartDebugger" parent="." instance=ExtResource("2_o5str")]
offset_left = 296.0
@ -44,6 +91,7 @@ initial_node_to_watch = NodePath("../HiroAI")
[node name="HiroAI" parent="." node_paths=PackedStringArray("player_character") instance=ExtResource("5_r7nw4")]
position = Vector2(135, 215)
player_character = NodePath("../HiroPlayer")
health = 400
attack_power = 5
[connection signal="attack_did_hit" from="HiroPlayer" to="HiroAI" method="_on_player_attack_did_hit"]