Better lava

This commit is contained in:
bingus_violet 2024-03-17 21:56:16 -05:00
parent 4f70414ed9
commit d0d7899340
82 changed files with 1747 additions and 738 deletions

View file

@ -9,7 +9,7 @@ func spin(veloc, delta):
var spinFactor = (veloc.x + vertSpinMult) / 40
spinFactor = clamp(spinFactor, -25, 25)
if player.direction or abs(player.velocity.x) > 100:
if (player.direction or abs(player.velocity.x) > 100) and not player.is_on_wall():
rotation = lerp(rotation, rotation + (spinFactor), delta)
else:
rotation = lerp(rotation, snappedf(rotation + clamp(spinFactor * delta * 2, -PI / 3, PI / 3), PI / 2), delta * 5)
@ -67,8 +67,8 @@ func _process(delta):
if not floored:
if player.is_on_ceiling() and landed < -100:
rotation = 0
scale.y = 1 + (landed / 800)
scale.x = 1 - (landed / 800)
scale.y = 1 + (landed / 800.)
scale.x = 1 - (landed / 800.)
spin(velocity, delta)

View file

@ -1,9 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://cqcjan67wgkc1"]
[gd_scene load_steps=10 format=3 uid="uid://cqcjan67wgkc1"]
[ext_resource type="Script" path="res://Player/BasicCharacter/CharacterController.gd" id="1_c5ycp"]
[ext_resource type="Script" path="res://Player/BasicCharacter/SoundScript.gd" id="3_ursor"]
[ext_resource type="AudioStream" uid="uid://d1rabaeyx578u" path="res://Player/BasicCharacter/Sounds/WallSlide/WallSlide.wav" id="4_s3e0l"]
[ext_resource type="Script" path="res://Player/BasicCharacter/Sounds/WallSlide/WallslideSound.gd" id="5_rp7we"]
[ext_resource type="AudioStream" uid="uid://d2hkg80n611cw" path="res://Player/BasicCharacter/Sounds/Landed.wav" id="6_7h6ch"]
[ext_resource type="AudioStream" uid="uid://ditim46yxen6i" path="res://Player/BasicCharacter/Sounds/SquishSound.wav" id="7_mp1ed"]
[ext_resource type="PackedScene" uid="uid://bl4g0ao3b8b6p" path="res://Player/BasicCharacter/sprite.tscn" id="8_pl8jo"]
[sub_resource type="CircleShape2D" id="CircleShape2D_jbiem"]
radius = 8.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_67e7r"]
size = Vector2(16, 16)
[sub_resource type="CircleShape2D" id="CircleShape2D_mnfw7"]
radius = 4.0
@ -17,12 +23,30 @@ script = ExtResource("1_c5ycp")
savedInputsPath = "res://Player/Ghosts/GhostData/testGhostRecording.res"
[node name="CircleCollider" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_jbiem")
shape = SubResource("RectangleShape2D_67e7r")
[node name="SquishDetection" type="Area2D" parent="."]
[node name="CircleCollider" type="CollisionShape2D" parent="SquishDetection"]
shape = SubResource("CircleShape2D_mnfw7")
[node name="Sounds" type="Node2D" parent="."]
script = ExtResource("3_ursor")
[node name="WallslideSound" type="AudioStreamPlayer2D" parent="Sounds"]
stream = ExtResource("4_s3e0l")
volume_db = -10.0
script = ExtResource("5_rp7we")
[node name="Landing" type="AudioStreamPlayer2D" parent="Sounds"]
stream = ExtResource("6_7h6ch")
[node name="Squish" type="AudioStreamPlayer2D" parent="Sounds"]
stream = ExtResource("7_mp1ed")
[node name="Sprite" parent="." instance=ExtResource("8_pl8jo")]
self_modulate = Color(1, 0, 0, 1)
[connection signal="Jumped" from="." to="Sounds" method="_on_character_jumped"]
[connection signal="body_shape_entered" from="SquishDetection" to="." method="_on_squish_detection_body_shape_entered"]
[connection signal="body_shape_exited" from="SquishDetection" to="." method="_on_squish_detection_body_shape_exited"]

View file

@ -4,6 +4,7 @@ const SPEED = 500.0
const ACCEL = 7.0
var direction = 0
var addedveloc = 0
var forcedVeloc = 0
const JUMP_VELOCITY = -450.0
const MAX_JUMPS = 1
@ -27,10 +28,11 @@ var startPos = Vector2.ZERO
var can_move = true
@onready var camera = $Camera
var camera : Camera2D
@export var savedInputsPath : String
var savedInputsRef = load(savedInputsPath)
@onready var sceneReload = load(get_tree().current_scene.scene_file_path)
var savedInputs = []
@ -66,10 +68,21 @@ func getAxis(inp1, inp2):
return Input.get_axis(inp1, inp2)
func isWallSliding():
for collisionNumb in get_slide_collision_count():
var collision = get_slide_collision(collisionNumb)
var object = collision.get_collider()
if object is TileMap:
var tileMap : TileMap = object
var tilePos = tileMap.get_coords_for_body_rid(collision.get_collider_rid())
var tileData = tileMap.get_cell_tile_data(0, tilePos)
if tileData and not tileData.get_custom_data("Slidable") == true:
return false
return is_on_wall_only() and direction
func getGravMulti():
var axis = (gen.boolToNumb(actionPressed("up"), 1))
var axis = (gen.boolToNumb(actionPressed("up") or forceLowGrav, 1))
if velocity.y < 0:
return axis
return 1
@ -78,11 +91,21 @@ func launch(veloc):
addedveloc = veloc
velocity.x = veloc
func forceLaunch(veloc):
forcedVeloc = veloc
velocity.x = veloc
signal Jumped
signal Died
var deathParticles = preload("res://Particles/Player/deathParticles.tscn")
var doubleWallJumped = false
var forceLowGrav = true
var landed = false
func die():
Died.emit()
var parti = deathParticles.instantiate()
@ -90,26 +113,20 @@ func die():
add_child(parti)
can_move = false
$Sprite.visible = false
var camTween = get_tree().create_tween()
camTween.set_trans(Tween.TRANS_SINE)
camTween.set_ease(Tween.EASE_IN_OUT)
#camTween.tween_property(camera, "global_position", global_position, 1)
camTween.tween_property(camera, "global_position", checkpointPos, (global_position.distance_to(checkpointPos) / 2500) + 0.5).set_delay(1)
await camTween.finished
parti = deathParticles.instantiate()
parti.modulate = $Sprite.self_modulate
add_child(parti)
$Sprite.visible = true
$"../Smoother".reset_node(self)
camera.position_smoothing_enabled = true
global_position = checkpointPos
camera.global_position = global_position
velocity = Vector2(0, -350)
can_move = true
gen.savedPos = checkpointPos
await Camera.deathAnim().finished
get_tree().change_scene_to_packed(sceneReload)
func _ready():
startPos = global_position
RenderingServer.set_default_clear_color(Color8(0, 0, 0))
if find_child("Camera"):
camera = $Camera
if ghostMode:
startPos = global_position
var rc = load(savedInputsPath)
if rc:
@ -141,12 +158,27 @@ func _ready():
elif inputName in held:
held.remove_at(held.find(inputName))
savedInputs[frame] += held
else:
Camera.player = self
var parti = deathParticles.instantiate()
parti.modulate = $Sprite.self_modulate
add_child(parti)
$Sprite.visible = true
$"../Smoother".reset_node(self)
#camera.position_smoothing_enabled = true
if gen.savedPos != Vector2.ZERO:
global_position = gen.savedPos
gen.savedPos = Vector2.ZERO
velocity = Vector2(0, 0)
#camera.reset_smoothing()
@onready var trail = $"Sprite/Trail"
var ghosting = true
var ghostParti = preload("res://Particles/Ghosts/spawnParticles.tscn")
var lastFloor = null
func spawnParti():
var parti = ghostParti.instantiate()
add_child(parti)
@ -178,17 +210,37 @@ func _physics_process(delta):
wallKayote -= delta
if is_on_floor() and !landed:
velocity.y = 0
if not is_on_floor():
if velocity.y < 2000:
velocity.y += gravity * delta / getGravMulti()
floorTime = 0
kayote -= delta
if lastFloor:
if "velocity" in lastFloor:
velocity += lastFloor.velocity
lastFloor = null
else:
#velocity.y = 0
doubleWallJumped = false
kayote = 0.3
floorTime += delta
jumps = MAX_JUMPS
falling = false
for collisionNumb in get_slide_collision_count():
var collision = get_slide_collision(collisionNumb)
var object = collision.get_collider()
if abs(collision.get_angle()) <= floor_max_angle:
lastFloor = object
if velocity.y <= 0:
forceLowGrav = false
if isWallSliding():
wallKayote = 0.3
@ -199,25 +251,25 @@ func _physics_process(delta):
if actionJustPressed("jump"):
if wallKayote > 0 and not is_on_floor():
wallKayote /= 2
var query = PhysicsRayQueryParameters2D.create(global_position + (get_wall_normal() * 32), global_position + (get_wall_normal() * -64))
query.exclude = [self]
var result = space_state.intersect_ray(query)
if result and "velocity" in result.collider:
velocity.y += result.collider.velocity.y
if doubleWallJumped:
wallKayote = 0
else:
doubleWallJumped = true
wallKayote += 0.1
if actionPressed("down"):
launch(get_wall_normal().x * SPEED * 1.75)
velocity.y = clamp((velocity.y / 2) + JUMP_VELOCITY / 1.8, -INF, JUMP_VELOCITY / 1.8)
else:
launch(get_wall_normal().x * SPEED * 1.35)
launch(get_wall_normal().x * SPEED * 1.4)
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
if result and "velocity" in result.collider:
velocity.x += result.collider.velocity.x
elif jumps > 0:
Jumped.emit()
#if result and "velocity" in result.collider:
#velocity.x += result.collider.velocity.x
elif jumps > 0:
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
doubleWallJumped = false
if kayote < 0:
jumps -= 1
else:
@ -229,10 +281,11 @@ func _physics_process(delta):
velocity += result.collider.velocity
falling = false
if actionPressed("down") and not is_on_floor() and kayote > 0:
launch(direction * SPEED * 1.75)
if actionPressed("down") and kayote > 0 and abs(velocity.x) < SPEED * 1.5:
launch(direction * SPEED * 1.5)
kayote = 0
Jumped.emit()
if actionJustPressed("down") and not falling and not isWallSliding():
falling = true
velocity.y = clamp(velocity.y + FALL_SPEED, FALL_SPEED, INF)
@ -244,7 +297,7 @@ func _physics_process(delta):
var query = PhysicsRayQueryParameters2D.create(global_position + (get_wall_normal() * 32), global_position + (get_wall_normal() * -64))
query.exclude = [self]
var result = space_state.intersect_ray(query)
print(result)
if result and "velocity" in result.collider and abs(result.collider.velocity.x) > 50:
velocity.y = lerpf(velocity.y, 0, delta * 30)
else:
@ -259,12 +312,21 @@ func _physics_process(delta):
if abs(velocity.x) < abs(addedveloc):
addedveloc = lerp(addedveloc, velocity.x, ACCEL * 2 * delta)
velocity.x += addedveloc * delta * 15
if abs(velocity.x) < abs(forcedVeloc):
forcedVeloc = lerp(forcedVeloc, velocity.x, ACCEL * 2 * delta)
velocity.x += forcedVeloc * delta * 35
addedveloc = lerpf(addedveloc, 0, delta * 5)
addedveloc = lerpf(addedveloc, 0, delta * 6)
if not is_on_floor():
forcedVeloc = lerpf(forcedVeloc, 0, delta)
else:
forcedVeloc = lerpf(forcedVeloc, 0, delta * 5)
landed = is_on_floor()
move_and_slide()
func _process(delta):
func _process(_delta):
if ghostMode:
if velocity.length() > 5:
trail.add_point(global_position)
@ -275,12 +337,11 @@ func _process(delta):
trail.remove_point(0)
func _on_squish_detection_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
func _on_squish_detection_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
squishers += 1
if squishers >= 2:
die()
func _on_squish_detection_body_shape_exited(body_rid, body, body_shape_index, local_shape_index):
func _on_squish_detection_body_shape_exited(_body_rid, _body, _body_shape_index, _local_shape_index):
squishers -= 1
print("Unsquish :(")

View file

@ -0,0 +1,26 @@
extends Node2D
@onready var player = get_parent()
var jump = preload("res://Player/BasicCharacter/Sounds/Jump/jump.tscn")
var lastJump = null
func _on_character_jumped():
var sound = jump.instantiate()
add_child(sound)
if is_instance_valid(lastJump):
sound.pitch_scale += 0.5
lastJump.queue_free()
lastJump = sound
var lastAir = true
func _physics_process(delta):
if player.is_on_floor() and lastAir:
lastAir = false
$Landing.play()
elif not player.is_on_floor():
lastAir = true
if Input.is_action_just_pressed("down") and player.is_on_floor():
$Squish.play()

View file

@ -0,0 +1,21 @@
extends AudioStreamPlayer2D
var immune = 0.3
@onready var player = $"../../"
func _ready():
#pitch_scale = player.velocity.y / player.JUMP_VELOCITY
play()
func _process(delta):
immune -= delta
if Input.is_action_pressed("jump") or immune > 0:
pitch_scale += delta * (pitch_scale)
volume_db -= delta * 15 * (1 - immune)
if player.is_on_floor():
queue_free()
func _on_finished():
queue_free()

View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=3 uid="uid://6r1nxts67d3y"]
[ext_resource type="AudioStream" uid="uid://brr87ocprh24d" path="res://Player/BasicCharacter/Sounds/Jump/jump.wav" id="1_teh8j"]
[ext_resource type="Script" path="res://Player/BasicCharacter/Sounds/Jump/jump.gd" id="2_pbb5s"]
[node name="Jump" type="AudioStreamPlayer2D"]
stream = ExtResource("1_teh8j")
volume_db = -9.333
script = ExtResource("2_pbb5s")
[connection signal="finished" from="." to="." method="_on_finished"]

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://brr87ocprh24d"
path="res://.godot/imported/jump.wav-c6b485806c8137a8a435843a1a298f4a.sample"
[deps]
source_file="res://Player/BasicCharacter/Sounds/Jump/jump.wav"
dest_files=["res://.godot/imported/jump.wav-c6b485806c8137a8a435843a1a298f4a.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d2hkg80n611cw"
path="res://.godot/imported/Landed.wav-13b34b4f1d2c96168e48383f65586176.sample"
[deps]
source_file="res://Player/BasicCharacter/Sounds/Landed.wav"
dest_files=["res://.godot/imported/Landed.wav-13b34b4f1d2c96168e48383f65586176.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://ditim46yxen6i"
path="res://.godot/imported/SquishSound.wav-ee207de3f25f8fd86f50260537e02e5e.sample"
[deps]
source_file="res://Player/BasicCharacter/Sounds/SquishSound.wav"
dest_files=["res://.godot/imported/SquishSound.wav-ee207de3f25f8fd86f50260537e02e5e.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d1rabaeyx578u"
path="res://.godot/imported/WallSlide.wav-9978fc2ada42c1cdff054ba186d3defa.sample"
[deps]
source_file="res://Player/BasicCharacter/Sounds/WallSlide/WallSlide.wav"
dest_files=["res://.godot/imported/WallSlide.wav-9978fc2ada42c1cdff054ba186d3defa.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop_mode=3
edit/loop_begin=10000
edit/loop_end=-5000
compress/mode=0

View file

@ -0,0 +1,11 @@
extends AudioStreamPlayer2D
@onready var player = $"../../"
func _physics_process(delta):
pitch_scale = lerp(pitch_scale, abs(player.velocity.y) / 200, delta * 5)
if player.isWallSliding() and playing == false:
playing = true
elif player.isWallSliding() == false:
playing = false

View file

@ -1,16 +1,51 @@
extends Camera2D
@onready var player = $"../"
var lastValid = false
var player = null
var speedMod = 0
func _ready():
get_tree().get_root().size_changed.connect(resize)
func resetZoom():
return Vector2.ONE * 3 * get_viewport().size.length() / 3000
func _process(delta):
var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000)
var direction = clamp(player.velocity.x, -1, 1)
if is_instance_valid(player):
var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000)
var direction = clamp(player.velocity.x, -1, 1)
speedMod = lerpf(speedMod, velocModifier * direction / 5, delta * 10)
speedMod = lerpf(speedMod, velocModifier * direction / 5, delta * 10)
zoom = Vector2.ONE * 3 * get_viewport().size.length() / 3000
global_position = (get_local_mouse_position() / 2.5) + player.global_position
global_position.x += speedMod
else:
lastValid = false
if player and not lastValid:
lastValid = true
var fader = $CanvasLayer/Fader
$CanvasLayer.visible = true
fader.offset = Vector2(0, get_viewport().size.y)
var tween = create_tween()
tween.set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_SINE)
tween.tween_property(fader, "offset", Vector2(0, get_viewport().size.y * 2), 0.5).set_delay(0.15)
global_position = player.global_position
zoom = resetZoom()
reset_smoothing()
await tween.finished
fader.offset = Vector2.ZERO
func resize():
zoom = resetZoom()
func deathAnim():
var fader = $CanvasLayer/Fader
var tween = create_tween()
tween.set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
position = (get_local_mouse_position() / 2.5)
position.x += speedMod
tween.tween_property(fader, "offset", Vector2(0, get_viewport().size.y), 0.3)
player = null
return tween

43
Player/Camera/camera.tscn Normal file
View file

@ -0,0 +1,43 @@
[gd_scene load_steps=7 format=3 uid="uid://b4j1qajvftyj6"]
[ext_resource type="Script" path="res://Player/Camera/CameraController.gd" id="1_uqcna"]
[ext_resource type="Script" path="res://Player/Lighting/EnableInGame.gd" id="2_i4v13"]
[ext_resource type="Script" path="res://Core/Scripts/Fader.gd" id="3_npxgr"]
[sub_resource type="Gradient" id="Gradient_p4qb5"]
offsets = PackedFloat32Array(0, 0.203704)
colors = PackedColorArray(0, 0, 0, 1, 0.886262, 0.886262, 0.886261, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_02bdl"]
gradient = SubResource("Gradient_p4qb5")
width = 3200
height = 3200
fill = 1
fill_from = Vector2(0.5, 0.5)
fill_to = Vector2(0, 0.5)
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_q82ne"]
[node name="Camera" type="Camera2D"]
process_priority = 1
zoom = Vector2(2, 2)
position_smoothing_enabled = true
position_smoothing_speed = 30.0
script = ExtResource("1_uqcna")
[node name="Dark" type="PointLight2D" parent="."]
enabled = false
energy = 0.5
blend_mode = 1
range_layer_min = -100
texture = SubResource("GradientTexture2D_02bdl")
script = ExtResource("2_i4v13")
[node name="CanvasLayer" type="CanvasLayer" parent="."]
visible = false
script = ExtResource("3_npxgr")
[node name="Fader" type="Sprite2D" parent="CanvasLayer"]
modulate = Color(0, 0, 0, 1)
texture = SubResource("NoiseTexture2D_q82ne")
centered = false

View file

@ -15,7 +15,7 @@ var active = false
func track():
saved.append(gen.getCurrentActions())
func _physics_process(delta):
func _physics_process(_delta):
if tracking:
track()

View file

@ -1,172 +1,8 @@
[gd_scene load_steps=9 format=3 uid="uid://c4x2fbs6bvxpp"]
[ext_resource type="Script" path="res://Player/BasicCharacter/CharacterController.gd" id="1_n3rkw"]
[ext_resource type="PackedScene" uid="uid://bl4g0ao3b8b6p" path="res://Player/BasicCharacter/sprite.tscn" id="2_mjdr3"]
[sub_resource type="GDScript" id="GDScript_nkjkv"]
script/source = "extends CharacterBody2D
const SPEED = 400.0
const ACCEL = 7.0
var direction = 0
var addedveloc = 0
const JUMP_VELOCITY = -450.0
const MAX_JUMPS = 2
var jumps = MAX_JUMPS
var wallKayote = 0
const FALL_SPEED = -JUMP_VELOCITY
var falling = false
var floorTime = 0
var gravity = ProjectSettings.get_setting(\"physics/2d/default_gravity\")
func isWallSliding():
return is_on_wall_only() and direction
func getGravMulti():
var axis = (gen.boolToNumb(ghostInputHeld(\"up\"), 1))
if velocity.y < 0:
return axis
return 1
func launch(veloc):
addedveloc = veloc
velocity.x = veloc
signal Jumped
func die():
position = Vector2.ZERO
velocity = Vector2.ZERO
var ghostFrame = 0
var startPos = Vector2.ZERO
@export var savedInputsPath : String
var savedInputsRef = load(savedInputsPath)
var savedInputs = []
func ghostInputJustPressed(action):
if action in savedInputs[ghostFrame] and not action in savedInputs[ghostFrame - 1]:
return true
return false
func ghostInputHeld(action):
if action in savedInputs[ghostFrame]:
return true
return false
func _ready():
startPos = global_position
var rc = load(savedInputsPath)
for x in rc:
var dict = {}
for y in x:
dict[y] = x[y]
savedInputs.append(dict)
@onready var trail = $\"Sprite/Trail\"
var ghosting = true
func _physics_process(delta):
if ghostFrame + 1 >= savedInputs.size():
ghostFrame = 0
global_position = startPos
trail.points = []
$Sprite.visible = false
ghosting = false
$SpawnParticles.emitting = true
await get_tree().create_timer(3).timeout
ghosting = true
$Sprite.visible = true
if ghosting:
if ghostFrame == 0:
$SpawnParticles.emitting = true
ghostFrame += 1
direction = 0
if ghostInputHeld(\"left\"):
direction -= 1
if ghostInputHeld(\"right\"):
direction += 1
wallKayote -= delta
if not is_on_floor():
if velocity.y < 2000:
velocity.y += gravity * delta / getGravMulti()
floorTime = 0
else:
floorTime += delta
jumps = MAX_JUMPS
falling = false
if isWallSliding():
wallKayote = 0.2
falling = false
if ghostInputJustPressed(\"respawn\") or position.y > 5000:
die()
if ghostInputJustPressed(\"jump\"):
if wallKayote > 0 and not is_on_floor():
wallKayote /= 2
if ghostInputHeld(\"down\"):
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)
elif jumps > 0:
Jumped.emit()
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
jumps -= 1
falling = false
if ghostInputJustPressed(\"down\") and not falling and not isWallSliding():
falling = true
velocity.y = clamp(velocity.y + FALL_SPEED, FALL_SPEED, INF)
if isWallSliding():
var upDown = 0
if ghostInputHeld(\"up\"):
upDown -= 0.5
if ghostInputHeld(\"down\"):
upDown += 1
var holdMulti = (upDown * 2) + 1
velocity.y = lerpf(velocity.y, clamp(velocity.y, JUMP_VELOCITY, 100 * holdMulti), delta * 10)
var finalSpeed = clamp(abs(velocity.x), SPEED, INF)
if floorTime > 0.05:
finalSpeed = clamp(lerp(finalSpeed, SPEED, delta * 20), SPEED, INF)
velocity.x = lerp(velocity.x, direction * finalSpeed, delta * ACCEL)
if abs(velocity.x) < abs(addedveloc):
addedveloc = lerp(addedveloc, velocity.x, ACCEL * 2 * delta)
velocity.x += addedveloc * delta * 15
addedveloc = lerpf(addedveloc, 0, delta * 5)
move_and_slide()
func _process(delta):
if velocity.length() > 5:
trail.add_point(global_position)
elif trail.get_point_count() > 0:
trail.remove_point(0)
if trail.get_point_count() > 100:
trail.remove_point(0)
"
[sub_resource type="CircleShape2D" id="CircleShape2D_jbiem"]
radius = 8.0
@ -207,7 +43,7 @@ scale_curve = SubResource("CurveTexture_ibtln")
collision_layer = 3
floor_stop_on_slope = false
floor_snap_length = 3.0
script = SubResource("GDScript_nkjkv")
script = ExtResource("1_n3rkw")
[node name="BoxCollider" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_jbiem")

View file

@ -76,7 +76,8 @@ func _physics_process(delta):
modulate = Color8(0, 255, 150)
proj.modulate = modulate
proj.velocity = (moveVector * 1500) + player.velocity
proj.velocity = (moveVector * (1500 + player.velocity.dot(moveVector))) #+ (player.velocity.normalized() * player.velocity.dot(moveVector))
print(player.velocity.dot(moveVector))
#grappleDur = 10
add_child(proj)