diff --git a/.DS_Store b/.DS_Store index ac78965..9449473 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/ActionRPG-HeartBeast/.DS_Store b/ActionRPG-HeartBeast/.DS_Store index b275a74..f5eadd5 100644 Binary files a/ActionRPG-HeartBeast/.DS_Store and b/ActionRPG-HeartBeast/.DS_Store differ diff --git a/ActionRPG-HeartBeast/Enemies/Bat.gd b/ActionRPG-HeartBeast/Enemies/Bat.gd index 99cb303..de9d630 100644 --- a/ActionRPG-HeartBeast/Enemies/Bat.gd +++ b/ActionRPG-HeartBeast/Enemies/Bat.gd @@ -21,6 +21,7 @@ onready var sprite = $AnimatedSprite onready var stats = $Stats onready var playerDetectionZone = $PlayerDetectionZone onready var hurtbox = $Hurtbox +onready var softCollision = $SoftCollision func _physics_process(delta): knockback = knockback.move_toward(Vector2.ZERO, 200 * delta) @@ -43,8 +44,11 @@ func _physics_process(delta): state = IDLE sprite.flip_h = velocity.x < 0 + if softCollision.is_colliding(): + velocity += softCollision.get_push_vector() * delta * 400 velocity = move_and_slide(velocity) + func seek_player(): if playerDetectionZone.can_see_player(): state = CHASE diff --git a/ActionRPG-HeartBeast/Enemies/Bat.tscn b/ActionRPG-HeartBeast/Enemies/Bat.tscn index 982fc58..b58c8e6 100644 --- a/ActionRPG-HeartBeast/Enemies/Bat.tscn +++ b/ActionRPG-HeartBeast/Enemies/Bat.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=2] +[gd_scene load_steps=20 format=2] [ext_resource path="res://Enemies/Bat.png" type="Texture" id=1] [ext_resource path="res://Shadows/SmallShadow.png" type="Texture" id=2] @@ -7,6 +7,7 @@ [ext_resource path="res://Stats.tscn" type="PackedScene" id=5] [ext_resource path="res://Enemies/PlayerDetectionZone.tscn" type="PackedScene" id=6] [ext_resource path="res://Overlap/Hitbox.tscn" type="PackedScene" id=7] +[ext_resource path="res://Overlap/SoftCollision.tscn" type="PackedScene" id=8] [sub_resource type="AtlasTexture" id=1] atlas = ExtResource( 1 ) @@ -49,6 +50,9 @@ radius = 61.0328 [sub_resource type="CircleShape2D" id=10] radius = 5.0 +[sub_resource type="CircleShape2D" id=11] +radius = 5.0 + [node name="Bat" type="KinematicBody2D"] collision_layer = 16 script = ExtResource( 4 ) @@ -56,7 +60,6 @@ script = ExtResource( 4 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="."] frames = SubResource( 6 ) animation = "Fly" -frame = 1 playing = true offset = Vector2( 0, -12 ) @@ -64,9 +67,11 @@ offset = Vector2( 0, -12 ) texture = ExtResource( 2 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="."] +visible = false shape = SubResource( 7 ) [node name="Hurtbox" parent="." instance=ExtResource( 3 )] +visible = false collision_layer = 8 [node name="CollisionShape2D" parent="Hurtbox" index="0"] @@ -77,21 +82,29 @@ shape = SubResource( 8 ) max_health = 2 [node name="PlayerDetectionZone" parent="." instance=ExtResource( 6 )] +visible = false [node name="CollisionShape2D" parent="PlayerDetectionZone" index="0"] modulate = Color( 1, 1, 1, 0.258824 ) shape = SubResource( 9 ) [node name="Hitbox" parent="." instance=ExtResource( 7 )] +visible = false collision_mask = 4 [node name="CollisionShape2D" parent="Hitbox" index="0"] position = Vector2( 0, -15 ) shape = SubResource( 10 ) +[node name="SoftCollision" parent="." instance=ExtResource( 8 )] + +[node name="CollisionShape2D" parent="SoftCollision" index="0"] +shape = SubResource( 11 ) + [connection signal="area_entered" from="Hurtbox" to="." method="_on_Hurtbox_area_entered"] [connection signal="no_health" from="Stats" to="." method="_on_Stats_no_health"] [editable path="Hurtbox"] [editable path="PlayerDetectionZone"] [editable path="Hitbox"] +[editable path="SoftCollision"] diff --git a/ActionRPG-HeartBeast/Overlap/SoftCollision.gd b/ActionRPG-HeartBeast/Overlap/SoftCollision.gd new file mode 100644 index 0000000..e5b4592 --- /dev/null +++ b/ActionRPG-HeartBeast/Overlap/SoftCollision.gd @@ -0,0 +1,14 @@ +extends Area2D + +func is_colliding(): + var areas = get_overlapping_areas() + return areas.size() > 0 + +func get_push_vector(): + var areas = get_overlapping_areas() + var push_vector = Vector2.ZERO + if is_colliding(): + var area = areas[0] + push_vector = area.global_position.direction_to(global_position) + push_vector = push_vector.normalized() + return push_vector diff --git a/ActionRPG-HeartBeast/Overlap/SoftCollision.tscn b/ActionRPG-HeartBeast/Overlap/SoftCollision.tscn new file mode 100644 index 0000000..db44a18 --- /dev/null +++ b/ActionRPG-HeartBeast/Overlap/SoftCollision.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Overlap/SoftCollision.gd" type="Script" id=1] + +[node name="SoftCollision" type="Area2D"] +script = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/ActionRPG-HeartBeast/World.tscn b/ActionRPG-HeartBeast/World.tscn index 3f26d5c..4beec2c 100644 --- a/ActionRPG-HeartBeast/World.tscn +++ b/ActionRPG-HeartBeast/World.tscn @@ -527,7 +527,7 @@ points = PoolVector2Array( 0, 0, 32, 0, 32, 32, 0, 32 ) position = Vector2( 160, 90 ) texture = ExtResource( 3 ) region_enabled = true -region_rect = Rect2( 0, 0, 320, 180 ) +region_rect = Rect2( 0, 0, 880, 448 ) [node name="DirtPathTileMap" type="TileMap" parent="."] tile_set = SubResource( 1 ) @@ -542,6 +542,11 @@ collision_mask = 0 format = 1 tile_data = PoolIntArray( 0, 0, 4, 1, 0, 196609, 2, 0, 196609, 3, 0, 196610, 7, 0, 196608, 8, 0, 196609, 9, 0, 7, 65536, 0, 131075, 65545, 0, 131075, 196611, 0, 3, 196617, 0, 3, 262144, 0, 0, 262145, 0, 1, 262146, 0, 1, 262147, 0, 131079, 262152, 0, 196608, 262153, 0, 262151, 327680, 0, 131072, 327681, 0, 131073, 327682, 0, 131073, 327683, 0, 131074, 327689, 0, 131075 ) +[node name="Camera2D" type="Camera2D" parent="."] +position = Vector2( 111, 71 ) +current = true +smoothing_enabled = true + [node name="YSort" type="YSort" parent="."] [node name="Player" parent="YSort" instance=ExtResource( 2 )] @@ -550,6 +555,9 @@ __meta__ = { "_edit_group_": true } +[node name="RemoteTransform2D" type="RemoteTransform2D" parent="YSort/Player"] +remote_path = NodePath("../../../Camera2D") + [node name="Bushes" type="YSort" parent="YSort"] [node name="Bush" parent="YSort/Bushes" instance=ExtResource( 1 )] @@ -616,4 +624,6 @@ margin_bottom = 40.0 [node name="TouchControls" parent="Control" instance=ExtResource( 7 )] -[node name="HealthUI" parent="." instance=ExtResource( 9 )] +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="HealthUI" parent="CanvasLayer" instance=ExtResource( 9 )] diff --git a/ActionRPG-HeartBeast/build/.DS_Store b/ActionRPG-HeartBeast/build/.DS_Store index 43db6ac..c6b9cfd 100644 Binary files a/ActionRPG-HeartBeast/build/.DS_Store and b/ActionRPG-HeartBeast/build/.DS_Store differ diff --git a/ActionRPG-HeartBeast/build/web/.DS_Store b/ActionRPG-HeartBeast/build/web/.DS_Store index 6f48151..a09edd2 100644 Binary files a/ActionRPG-HeartBeast/build/web/.DS_Store and b/ActionRPG-HeartBeast/build/web/.DS_Store differ diff --git a/ActionRPG-HeartBeast/build/web/ActionRPG-web.zip b/ActionRPG-HeartBeast/build/web/ActionRPG-web.zip index d6d1d7f..9adc069 100644 Binary files a/ActionRPG-HeartBeast/build/web/ActionRPG-web.zip and b/ActionRPG-HeartBeast/build/web/ActionRPG-web.zip differ diff --git a/ActionRPG-HeartBeast/build/web/index.html b/ActionRPG-HeartBeast/build/web/index.html index 82c7d81..ef0c3e8 100644 --- a/ActionRPG-HeartBeast/build/web/index.html +++ b/ActionRPG-HeartBeast/build/web/index.html @@ -139,7 +139,7 @@