This commit is contained in:
bingus_violet 2024-03-13 16:15:55 -05:00
parent 279b5e5599
commit 4f70414ed9
46 changed files with 1485 additions and 170 deletions

View file

@ -10,6 +10,9 @@ var detecting = true
var partiDebounce = true
var target = null
var bodyOffset = Vector2.ZERO
func objectHit(body):
if body != self:
velocity = Vector2.ZERO
@ -26,7 +29,7 @@ func _physics_process(delta):
if detecting:
if lifeTime <= 0:
velocity = Vector2.ZERO
velocity = -velocity
parent.retractingProj.append({"proj": self, "retractStart": position, "retractDur": 0})
parent.grappling = false
parent.proj = null
@ -39,7 +42,11 @@ func _physics_process(delta):
if result:
detecting = false
position = result.position
global_position = result.position
target = result.collider
bodyOffset = global_position - result.collider.global_position
objectHit(result.collider)
elif parent.grappling and target:
global_position = target.global_position + bodyOffset
lastPos = position
lastPos = global_position

View file

@ -36,7 +36,7 @@ platform_floor_layers = 4294967040
script = ExtResource("1_nba88")
[node name="Sprite" type="Sprite2D" parent="."]
z_index = 2
z_index = 4
texture = ExtResource("2_sst4t")
[node name="GrappleLine" type="Line2D" parent="."]