Grapple effects & particles & stuff :)

This commit is contained in:
Bingus_Violet 2024-02-27 11:27:54 -06:00
parent c290b1ce72
commit 421220e763
13 changed files with 203 additions and 61 deletions

View file

@ -6,12 +6,13 @@ var spinAccel = 0
func spin(veloc, delta):
var vertSpinMult = abs(veloc.y) * clamp(veloc.x, -1, 1) / 1.5
var spinFactor = (veloc.x + vertSpinMult) / 30
var spinFactor = (veloc.x + vertSpinMult) / 40
spinFactor = clamp(spinFactor, -25, 25)
if player.direction or abs(player.velocity.x) > 100:
rotation = lerp(rotation, rotation + (spinFactor), delta)
else:
rotation = lerp(rotation, snappedf(rotation + (spinFactor * delta * 2), PI / 2), delta * 5)
rotation = lerp(rotation, snappedf(rotation + clamp(spinFactor * delta * 2, -PI / 3, PI / 3), PI / 2), delta * 5)
var landed = 0

View file

@ -8,9 +8,10 @@ var addedveloc = 0
const JUMP_VELOCITY = -450.0
const MAX_JUMPS = 2
var jumps = MAX_JUMPS
var wallKayote = 0
const FALL_SPEED = -JUMP_VELOCITY * 1.5
const FALL_SPEED = -JUMP_VELOCITY
var falling = false
var floorTime = 0
@ -20,6 +21,12 @@ var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func isWallSliding():
return is_on_wall_only() and direction
func getGravMulti():
var axis = (gen.boolToNumb(Input.is_action_pressed("up"), 1))
if velocity.y < 0:
return axis
return 1
func launch(veloc):
addedveloc = veloc
velocity.x = veloc
@ -27,13 +34,15 @@ func launch(veloc):
signal Jumped
func _physics_process(delta):
direction = round(Input.get_axis("left", "right"))
wallKayote -= delta
if not is_on_floor():
var lowGrav = velocity.y < 0 and (Input.is_action_pressed("up") or Input.is_action_pressed("jump"))
velocity.y += gravity * delta / gen.boolToNumb(lowGrav, 1)
if velocity.y < 1500:
var lowGrav = velocity.y < 0 and (Input.is_action_pressed("up") or Input.is_action_pressed("jump"))
velocity.y += gravity * delta / getGravMulti()
floorTime = 0
else:
@ -45,7 +54,7 @@ func _physics_process(delta):
wallKayote = 0.2
falling = false
if Input.is_action_just_pressed("respawn") or position.y > 500:
if Input.is_action_just_pressed("respawn") or position.y > 5000:
position = Vector2.ZERO
velocity = Vector2.ZERO
@ -53,8 +62,8 @@ func _physics_process(delta):
if wallKayote > 0 and not is_on_floor():
wallKayote /= 2
if Input.is_action_pressed("down"):
launch(get_wall_normal().x * SPEED * 2.5)
velocity.y = JUMP_VELOCITY / 2
launch(get_wall_normal().x * SPEED * 2)
velocity.y = JUMP_VELOCITY / 1.8
else:
launch(get_wall_normal().x * SPEED * 1.5)
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)