Grapple effects & particles & stuff :)
This commit is contained in:
parent
c290b1ce72
commit
421220e763
13 changed files with 203 additions and 61 deletions
|
@ -8,6 +8,8 @@ var lastPos = null
|
|||
|
||||
var detecting = true
|
||||
|
||||
var partiDebounce = true
|
||||
|
||||
func objectHit(body):
|
||||
if body != self:
|
||||
velocity = Vector2.ZERO
|
||||
|
@ -19,11 +21,15 @@ func _physics_process(delta):
|
|||
|
||||
move_and_slide()
|
||||
|
||||
$"parti".emitting = (lastPos - position).length() > 0
|
||||
|
||||
if detecting:
|
||||
if lifeTime <= 0:
|
||||
velocity = Vector2.ZERO
|
||||
parent.retracting = true
|
||||
parent.retractStart = position
|
||||
parent.retractingProj.append({"proj": self, "retractStart": position, "retractDur": 0})
|
||||
parent.grappling = false
|
||||
parent.proj = null
|
||||
detecting = false
|
||||
lifeTime -= delta
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
|
||||
|
@ -34,4 +40,4 @@ func _physics_process(delta):
|
|||
detecting = false
|
||||
position = result.position
|
||||
objectHit(result.collider)
|
||||
print(result.position)
|
||||
lastPos = position
|
||||
|
|
|
@ -1,9 +1,29 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dmgf8fsvy1wjh"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dmgf8fsvy1wjh"]
|
||||
|
||||
[ext_resource type="Script" path="res://Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.gd" id="1_nba88"]
|
||||
[ext_resource type="Texture2D" uid="uid://bncu47o5ynskj" path="res://Player/GrappleHook/GrappleHookProjectile/Grapple.png" id="2_sst4t"]
|
||||
[ext_resource type="Texture2D" uid="uid://gn347ng3iu02" path="res://Player/GrappleHook/GrappleHookProjectile/GrappleTether.png" id="2_xkdsl"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_qnwwb"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -2.51429, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_f4r8k"]
|
||||
curve = SubResource("Curve_qnwwb")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_tkwr2"]
|
||||
particle_flag_align_y = true
|
||||
particle_flag_disable_z = true
|
||||
inherit_velocity_ratio = 0.1
|
||||
spread = 180.0
|
||||
initial_velocity_min = 50.0
|
||||
initial_velocity_max = 50.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
damping_min = 50.0
|
||||
damping_max = 50.0
|
||||
scale_max = 2.0
|
||||
scale_curve = SubResource("CurveTexture_f4r8k")
|
||||
|
||||
[node name="GrappleHook" type="CharacterBody2D"]
|
||||
top_level = true
|
||||
disable_mode = 2
|
||||
|
@ -41,3 +61,11 @@ joint_mode = 2
|
|||
begin_cap_mode = 2
|
||||
end_cap_mode = 2
|
||||
round_precision = 4
|
||||
|
||||
[node name="parti" type="GPUParticles2D" parent="."]
|
||||
amount = 100
|
||||
process_material = SubResource("ParticleProcessMaterial_tkwr2")
|
||||
lifetime = 2.0
|
||||
fixed_fps = 0
|
||||
interpolate = false
|
||||
visibility_rect = Rect2(-12500, -12500, 25000, 25000)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue