silly sparks thing
This commit is contained in:
parent
638495f4a3
commit
68b3e1132f
11 changed files with 172 additions and 8 deletions
|
@ -7,8 +7,12 @@ extends CharacterBody2D
|
|||
@export var max_run_speed: float
|
||||
@export var turn_acceleration: float
|
||||
@export var stopping_force: float
|
||||
|
||||
@export_group("Bonk")
|
||||
@export var bonk_speed_threshold: float
|
||||
@export var bonk_power: float
|
||||
@export var bonk_effect_count: int
|
||||
@export var bonk_effect_scene: PackedScene
|
||||
|
||||
@export_group("Air Movement")
|
||||
@export var gravity: float
|
||||
|
@ -30,6 +34,8 @@ extends CharacterBody2D
|
|||
@export var corner_snap_point: Node2D
|
||||
@export var vault_off_point: Node2D
|
||||
|
||||
@export var bonk_effect_point: Node2D
|
||||
|
||||
|
||||
@onready var start_position: Vector2 = global_position
|
||||
|
||||
|
@ -113,6 +119,10 @@ func _cancel_bonk() -> void:
|
|||
|
||||
func _apply_bonk() -> void:
|
||||
velocity.x = signf(_bonk_cancel_velocity.x) * bonk_power
|
||||
for _i in bonk_effect_count:
|
||||
var effect_instance = bonk_effect_scene.instantiate()
|
||||
effect_instance.global_position = global_position
|
||||
get_parent().add_child(effect_instance)
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=36 format=3 uid="uid://bwtpsjpe2lf7l"]
|
||||
[gd_scene load_steps=37 format=3 uid="uid://bwtpsjpe2lf7l"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dhyi4yn0xleoy" path="res://objects/player/player.gd" id="1_xs4s5"]
|
||||
[ext_resource type="PackedScene" uid="uid://djdpcsmms727b" path="res://objects/effects/bouncing_spark.tscn" id="2_28utn"]
|
||||
[ext_resource type="Texture2D" uid="uid://c71nqfyw4a3v4" path="res://assets/textures/player/capri.png" id="3_trcll"]
|
||||
[ext_resource type="Script" uid="uid://cv55s54clajw5" path="res://scripts/spritesheet_animation/spritesheet_animation.gd" id="4_bsdw5"]
|
||||
[ext_resource type="AudioStream" uid="uid://4kxio0mlrr4k" path="res://assets/audio/vox/capri_jump2.ogg" id="5_45urx"]
|
||||
|
@ -108,7 +109,7 @@ script = ExtResource("8_8i2im")
|
|||
expression = "velocity.y > 0.0"
|
||||
metadata/_custom_type_script = "uid://b6u7unac5srh0"
|
||||
|
||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("state_chart", "graphics", "run_animation", "wall_cast", "corner_cast", "corner_height_cast", "corner_snap_point", "vault_off_point")]
|
||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("state_chart", "graphics", "run_animation", "wall_cast", "corner_cast", "corner_height_cast", "corner_snap_point", "vault_off_point", "bonk_effect_point")]
|
||||
collision_layer = 16
|
||||
collision_mask = 3
|
||||
floor_snap_length = 3.0
|
||||
|
@ -119,6 +120,8 @@ turn_acceleration = 300.0
|
|||
stopping_force = 250.0
|
||||
bonk_speed_threshold = 75.0
|
||||
bonk_power = 80.0
|
||||
bonk_effect_count = 3
|
||||
bonk_effect_scene = ExtResource("2_28utn")
|
||||
gravity = 450.0
|
||||
fast_gravity = 675.0
|
||||
jump_power = 180.0
|
||||
|
@ -134,6 +137,7 @@ corner_cast = NodePath("Graphics/CornerDetector/CornerCast")
|
|||
corner_height_cast = NodePath("Graphics/CornerDetector/CornerHeightCast")
|
||||
corner_snap_point = NodePath("Graphics/CornerDetector/CornerSnapPoint")
|
||||
vault_off_point = NodePath("Graphics/CornerDetector/VaultOffPoint")
|
||||
bonk_effect_point = NodePath("Graphics/SparksPoint")
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_tvyy1")
|
||||
|
@ -232,6 +236,9 @@ position = Vector2(4, 2)
|
|||
[node name="VaultOffPoint" type="Node2D" parent="Graphics/CornerDetector"]
|
||||
position = Vector2(2, 7)
|
||||
|
||||
[node name="SparksPoint" type="Node2D" parent="Graphics"]
|
||||
position = Vector2(8, 0)
|
||||
|
||||
[node name="Sounds" type="Node" parent="."]
|
||||
|
||||
[node name="Jump" type="AudioStreamPlayer" parent="Sounds"]
|
||||
|
@ -517,16 +524,16 @@ delay_in_seconds = "0.0"
|
|||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded" to="." method="_check_for_bonk"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing/Idle" to="Graphics/Sprite/Idle" method="play"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Standing/Stopping" to="Graphics/Sprite/Run" method="play"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Standing/Stopping" to="." method="_slow_to_stop"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Standing/Stopping" to="." method="_scale_run_animation"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Standing/Stopping" to="." method="_slow_to_stop"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Running" to="Graphics/Sprite/Run" method="play"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Running" to="." method="_scale_run_animation"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Running" to="." method="_apply_run_acceleration"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Grounded/Turning" to="Graphics/Sprite/Skid" method="play"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Grounded/Turning" to="." method="_apply_turn_acceleration"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_apply_gravity"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_check_for_corner"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_check_for_bonk"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_check_for_corner"]
|
||||
[connection signal="state_physics_processing" from="StateChart/Root/Airborne" to="." method="_apply_gravity"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Falling" to="Graphics/Sprite/Fall" method="play"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping" to="Graphics/Sprite/Jump" method="play"]
|
||||
[connection signal="state_entered" from="StateChart/Root/Airborne/Jumping/FromGround" to="." method="_start_jump"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue