Make some gameplay tweaks
This commit is contained in:
parent
a24a4e1403
commit
533bc2c60b
4 changed files with 94 additions and 40 deletions
|
@ -227,17 +227,18 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
|||
graph_offset = Vector2(273, 34)
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
|
||||
radius = 8.0
|
||||
radius = 9.0
|
||||
height = 36.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bdqvd"]
|
||||
size = Vector2(13, 8)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_md645"]
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
|
||||
height = 20.0
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_hxosv"]
|
||||
radius = 12.0
|
||||
height = 44.0
|
||||
radius = 13.0
|
||||
height = 36.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ri8lv"]
|
||||
script = ExtResource("9_ak1rc")
|
||||
|
@ -252,6 +253,7 @@ y_sort_enabled = true
|
|||
collision_layer = 5
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_inmen")
|
||||
reduce_recoil_time_threshold = 0.75
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.498039, 0.498039, 0.498039, 1)
|
||||
|
@ -277,14 +279,13 @@ parameters/melee/2/blend_position = Vector2(0, 0)
|
|||
parameters/walk/blend_position = Vector2(-0.0100167, -0.0729166)
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(0, 1)
|
||||
collision_layer = 2
|
||||
collision_mask = 10
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="Collider" type="CollisionShape2D" parent="Hitbox"]
|
||||
visible = false
|
||||
position = Vector2(0, -14)
|
||||
position = Vector2(0, -13)
|
||||
shape = SubResource("CapsuleShape2D_vm050")
|
||||
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
|
||||
|
||||
|
@ -293,26 +294,22 @@ position = Vector2(-0.5, -1)
|
|||
shape = SubResource("RectangleShape2D_bdqvd")
|
||||
|
||||
[node name="Attackbox" type="Area2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(0, 1)
|
||||
collision_layer = 8
|
||||
collision_mask = 2
|
||||
input_pickable = false
|
||||
|
||||
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
|
||||
visible = false
|
||||
position = Vector2(0, -10)
|
||||
shape = SubResource("CircleShape2D_md645")
|
||||
shape = SubResource("CapsuleShape2D_m3ug4")
|
||||
disabled = true
|
||||
debug_color = Color(0.745098, 0.462745, 0, 0.419608)
|
||||
|
||||
[node name="Meleebox" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 4
|
||||
|
||||
[node name="DetectionArea" type="CollisionShape2D" parent="Meleebox"]
|
||||
visible = false
|
||||
position = Vector2(0, -13)
|
||||
position = Vector2(0, -12)
|
||||
shape = SubResource("CapsuleShape2D_hxosv")
|
||||
debug_color = Color(0.784314, 0.423529, 0.27451, 0.419608)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="AnimationLibrary" load_steps=34 format=3 uid="uid://dincs5x4qucal"]
|
||||
[gd_resource type="AnimationLibrary" load_steps=35 format=3 uid="uid://dincs5x4qucal"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="1_hc7kj"]
|
||||
[ext_resource type="Texture2D" uid="uid://rcidedgcjqg6" path="res://Hiro/Hiro Hurt Sprites.png" id="2_2k6ad"]
|
||||
|
@ -6,6 +6,9 @@
|
|||
[ext_resource type="Texture2D" uid="uid://06a1bf8kjte6" path="res://Hiro/Hiro Defeated Sprites nb.png" id="4_fugxd"]
|
||||
[ext_resource type="Texture2D" uid="uid://byc7mqu65fb4a" path="res://Hiro/Hiro Defeated Nude Sprites Line.png" id="5_0f03l"]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
|
||||
height = 20.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_04piu"]
|
||||
length = 0.40001
|
||||
step = 0.5
|
||||
|
@ -76,10 +79,10 @@ tracks/5/path = NodePath("Attackbox/Collider:position")
|
|||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"times": PackedFloat32Array(0, 0.0666667),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -10)]
|
||||
"values": [Vector2(0, -10), Vector2(0, -14)]
|
||||
}
|
||||
tracks/6/type = "value"
|
||||
tracks/6/imported = false
|
||||
|
@ -105,6 +108,18 @@ tracks/7/keys = {
|
|||
"update": 0,
|
||||
"values": [Color(1, 0, 0, 0)]
|
||||
}
|
||||
tracks/8/type = "value"
|
||||
tracks/8/imported = false
|
||||
tracks/8/enabled = true
|
||||
tracks/8/path = NodePath("Attackbox/Collider:shape")
|
||||
tracks/8/interp = 1
|
||||
tracks/8/loop_wrap = true
|
||||
tracks/8/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [SubResource("CapsuleShape2D_m3ug4")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ry0wg"]
|
||||
resource_name = "ai_defeated"
|
||||
|
@ -790,7 +805,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(6, -11), Vector2(6, -11), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -14), Vector2(4, -14), Vector2(4, -14), Vector2(0.999395, -14)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_cuaji"]
|
||||
|
@ -879,7 +894,19 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(0, -27), Vector2(12, -11), Vector2(0, -27), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -23), Vector2(12, -11), Vector2(0, -23), Vector2(0.999395, -14)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("Attackbox/Collider:shape")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0.133333),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [SubResource("CapsuleShape2D_m3ug4")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_hqga6"]
|
||||
|
@ -968,7 +995,19 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -2), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -3), Vector2(12, -11), Vector2(0, -3), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("Attackbox/Collider:shape")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0.2),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [SubResource("CapsuleShape2D_m3ug4")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_s8xim"]
|
||||
|
@ -1057,7 +1096,19 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(-4, -14), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
tracks/7/type = "value"
|
||||
tracks/7/imported = false
|
||||
tracks/7/enabled = true
|
||||
tracks/7/path = NodePath("Attackbox/Collider:shape")
|
||||
tracks/7/interp = 1
|
||||
tracks/7/loop_wrap = true
|
||||
tracks/7/keys = {
|
||||
"times": PackedFloat32Array(0.2),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [SubResource("CapsuleShape2D_m3ug4")]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_g1svr"]
|
||||
|
@ -1199,7 +1250,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(4, -11), Vector2(6, -11), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(4, -14), Vector2(4, -14), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ar6r3"]
|
||||
|
@ -1285,10 +1336,10 @@ tracks/6/path = NodePath("Attackbox/Collider:position")
|
|||
tracks/6/interp = 1
|
||||
tracks/6/loop_wrap = true
|
||||
tracks/6/keys = {
|
||||
"times": PackedFloat32Array(0, 0.133333, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(6, -11), Vector2(6, -11), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -14), Vector2(4, -14), Vector2(4, -14), Vector2(0.999395, -14)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_1e0v6"]
|
||||
|
@ -1338,7 +1389,7 @@ tracks/3/path = NodePath("Sprite2D:frame")
|
|||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0, 0.0666667, 0.133333, 0.2),
|
||||
"times": PackedFloat32Array(0, 0.0666667, 0.1334, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [31, 32, 33, 34]
|
||||
|
@ -1377,7 +1428,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(0, -27), Vector2(12, -11), Vector2(0, -27), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -23), Vector2(12, -11), Vector2(0, -23), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bwm5c"]
|
||||
|
@ -1466,7 +1517,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(0, -26), Vector2(12, -11), Vector2(0, -26), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -23), Vector2(12, -11), Vector2(0, -23), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qmuik"]
|
||||
|
@ -1555,7 +1606,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -4), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -3), Vector2(12, -11), Vector2(0, -3), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_bw220"]
|
||||
|
@ -1644,7 +1695,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(0, -2), Vector2(12, -11), Vector2(0, -2), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(0, -3), Vector2(12, -11), Vector2(0, -3), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_wjl2t"]
|
||||
|
@ -1733,7 +1784,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(12, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(12, -11), Vector2(-4, -14), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_e4rxs"]
|
||||
|
@ -1822,7 +1873,7 @@ tracks/6/keys = {
|
|||
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [Vector2(0, -11), Vector2(-6, -11), Vector2(12, -11), Vector2(-6, -11), Vector2(-0.00060463, -11)]
|
||||
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(12, -11), Vector2(-4, -14), Vector2(-0.00060463, -11)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_de3xn"]
|
||||
|
|
|
@ -223,13 +223,14 @@ transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition
|
|||
graph_offset = Vector2(12, 21.3541)
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
|
||||
radius = 8.0
|
||||
radius = 9.0
|
||||
height = 36.0
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bdqvd"]
|
||||
size = Vector2(13, 8)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_md645"]
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
|
||||
height = 20.0
|
||||
|
||||
[node name="HiroPlayer" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
|
@ -265,7 +266,7 @@ collision_layer = 2
|
|||
collision_mask = 10
|
||||
|
||||
[node name="Collider" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2(0, -14)
|
||||
position = Vector2(0, -13)
|
||||
shape = SubResource("CapsuleShape2D_vm050")
|
||||
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
|
||||
|
||||
|
@ -281,7 +282,7 @@ input_pickable = false
|
|||
|
||||
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
|
||||
position = Vector2(0, -10)
|
||||
shape = SubResource("CircleShape2D_md645")
|
||||
shape = SubResource("CapsuleShape2D_m3ug4")
|
||||
disabled = true
|
||||
debug_color = Color(0.745098, 0.462745, 0, 0.419608)
|
||||
|
||||
|
|
|
@ -8,6 +8,11 @@ extends CharacterBody2D
|
|||
@export var KNOCKBACK_REPOSITION_POWER = 75
|
||||
@export var KNOCKBACK_RANDOMNESS = 50
|
||||
@export var MELEE_RADIUS = 75
|
||||
@export var chase_speed = 65
|
||||
@export var approach_speed = 40
|
||||
@export var min_recoil_time = 3.0/60.0
|
||||
@export var max_recoil_time = 1.0
|
||||
@export var reduce_recoil_time_threshold = 58.0/60.0
|
||||
@onready var anim_tree: AnimationTree = $AnimationTree
|
||||
@onready var anim_playback: AnimationNodeStateMachinePlayback = anim_tree["parameters/playback"]
|
||||
@onready var state_machine: StateChart = $StateMachine
|
||||
|
@ -59,8 +64,8 @@ func _on_ai_got_hurt(attack_power: int, attack_direction: Vector2):
|
|||
## Thinking state
|
||||
## Once some time passes out, do_thinking is called
|
||||
func _on_think_state_entered():
|
||||
timer = randf_range(3.0/60.0, 1.5)
|
||||
if timer <= 88.0/90.0:
|
||||
timer = randf_range(min_recoil_time, max_recoil_time)
|
||||
if timer <= reduce_recoil_time_threshold:
|
||||
timer = timer * 0.75
|
||||
|
||||
func _on_think_state_processing(delta):
|
||||
|
@ -154,7 +159,7 @@ func _on_defeat_state_entered():
|
|||
|
||||
## Aproaching
|
||||
func _on_approach_state_entered():
|
||||
follow_player(25)
|
||||
follow_player(approach_speed)
|
||||
anim_tree.set("parameters/conditions/is_moving", true)
|
||||
timer = 1
|
||||
|
||||
|
@ -177,7 +182,7 @@ func _on_chase_state_entered():
|
|||
anim_tree.set("parameters/conditions/is_moving", true)
|
||||
|
||||
func _on_chase_state_processing(_delta):
|
||||
follow_player(65)
|
||||
follow_player(chase_speed)
|
||||
var distance = position.distance_to(player_character.position)
|
||||
if distance >= MELEE_RADIUS:
|
||||
state_machine.send_event("melee_aborted")
|
||||
|
|
Loading…
Reference in a new issue