AAAA
This commit is contained in:
parent
279b5e5599
commit
4f70414ed9
46 changed files with 1485 additions and 170 deletions
|
@ -5,8 +5,6 @@ extends Node2D
|
|||
|
||||
@onready var grappleCore = $"GrappleCore"
|
||||
|
||||
@onready var Smoother = $"../../../Smoother"
|
||||
|
||||
var grappleProjectile = preload("res://Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.tscn")
|
||||
|
||||
var proj = null
|
||||
|
@ -46,17 +44,19 @@ func renderLine(proj):
|
|||
func launch(delta):
|
||||
if proj:
|
||||
player.jumps = player.MAX_JUMPS - 1
|
||||
var grappleVeloc = (proj.position - player.position).normalized() * grappleSpeed
|
||||
var distance = proj.global_position - player.global_position
|
||||
var grappleVeloc = distance.normalized() * (grappleSpeed + distance.length())
|
||||
player.launch(grappleVeloc.x)
|
||||
player.velocity.y = lerp(player.velocity.y, grappleVeloc.y, 10 * delta)
|
||||
|
||||
func grappleStart():
|
||||
grappleSpeed = (500 + clamp(player.velocity.length(), 500, 1000))
|
||||
grappleDur = 0.5
|
||||
grappleSpeed = (500 + clamp(player.velocity.length(), 500, 2000))
|
||||
grappleDur = 0.1
|
||||
grappling = true
|
||||
|
||||
func _physics_process(delta):
|
||||
grappleDur -= delta
|
||||
if not Input.is_action_pressed("pullGrapple"):
|
||||
grappleDur -= delta
|
||||
|
||||
var moveVector = (get_global_mouse_position() - player.position).normalized()
|
||||
|
||||
|
@ -73,10 +73,10 @@ func _physics_process(delta):
|
|||
proj.position = player.position
|
||||
proj.rotation = moveVector.angle()
|
||||
|
||||
modulate = Color8(0, 255, 0)
|
||||
modulate = Color8(0, 255, 150)
|
||||
proj.modulate = modulate
|
||||
|
||||
proj.velocity = (moveVector * 1000) + player.velocity
|
||||
proj.velocity = (moveVector * 1500) + player.velocity
|
||||
#grappleDur = 10
|
||||
add_child(proj)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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="."]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue