AAAA
This commit is contained in:
parent
279b5e5599
commit
4f70414ed9
46 changed files with 1485 additions and 170 deletions
|
@ -29,10 +29,13 @@ var imageTimer = 0
|
|||
var imaging = false
|
||||
var lastImage = Vector2.ZERO
|
||||
|
||||
func _ready():
|
||||
if player.has_signal("Jumped"):
|
||||
player.Jumped.connect(_on_character_jumped)
|
||||
|
||||
func _process(delta):
|
||||
|
||||
var velocity = player.velocity
|
||||
var grapple = $"Grapple/GrappleCore"
|
||||
|
||||
var floored = player.is_on_floor()
|
||||
|
||||
|
@ -41,7 +44,7 @@ func _process(delta):
|
|||
elif velocity.length() < 800:
|
||||
imaging = false
|
||||
|
||||
if (imaging or find_child("Grapple") and $"Grapple".grappling) and (global_position - lastImage).length() > 16:
|
||||
if (imaging or (find_child("Grapple") and $"Grapple".grappling)) and (global_position - lastImage).length() > 16:
|
||||
var parti = afterImage.instantiate()
|
||||
add_child(parti)
|
||||
parti.duration = velocity.length() / 2000
|
||||
|
@ -62,6 +65,12 @@ func _process(delta):
|
|||
disableSlidingVariants()
|
||||
|
||||
if not floored:
|
||||
if player.is_on_ceiling() and landed < -100:
|
||||
rotation = 0
|
||||
scale.y = 1 + (landed / 800)
|
||||
scale.x = 1 - (landed / 800)
|
||||
|
||||
|
||||
spin(velocity, delta)
|
||||
landed = velocity.y
|
||||
|
||||
|
@ -97,11 +106,14 @@ func _process(delta):
|
|||
offset.y = (8 * pow(scale.y, -1) - 8)
|
||||
offset.x = 0
|
||||
|
||||
grapple.offset = offset
|
||||
|
||||
if find_child("Grapple"):
|
||||
$"Grapple/GrappleCore".offset = offset
|
||||
|
||||
func _on_character_jumped():
|
||||
if not player.direction:
|
||||
rotation = 0
|
||||
scale.y = 1.5
|
||||
scale.x = 0.5
|
||||
else:
|
||||
scale = Vector2.ONE
|
||||
offset = Vector2.ZERO
|
||||
|
|
|
@ -1,85 +1,28 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://cqcjan67wgkc1"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cqcjan67wgkc1"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dvx8lliqdi3dv" path="res://Player/Skins/Square/Square.png" id="1_3vfyw"]
|
||||
[ext_resource type="Script" path="res://Player/BasicCharacter/CharacterController.gd" id="1_c5ycp"]
|
||||
[ext_resource type="Script" path="res://Player/Camera/CameraController.gd" id="2_yp33m"]
|
||||
[ext_resource type="Script" path="res://Player/BasicCharacter/AnimationController.gd" id="3_6plye"]
|
||||
[ext_resource type="Script" path="res://Player/GrappleHook/GrappleHook.gd" id="5_sv1u0"]
|
||||
[ext_resource type="Texture2D" uid="uid://bi5ofgcvid5qk" path="res://Player/GrappleHook/GrappleCenter.png" id="6_ismrc"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jbiem"]
|
||||
radius = 8.0
|
||||
|
||||
[sub_resource type="Curve" id="Curve_ky2t4"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.738916, 0), -1.78462, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_1w0c6"]
|
||||
curve = SubResource("Curve_ky2t4")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_65t6y"]
|
||||
particle_flag_align_y = true
|
||||
particle_flag_disable_z = true
|
||||
particle_flag_damping_as_friction = true
|
||||
direction = Vector3(0, -1, 0)
|
||||
initial_velocity_min = 34.78
|
||||
initial_velocity_max = 34.78
|
||||
gravity = Vector3(0, 250, 0)
|
||||
scale_min = 2.0
|
||||
scale_max = 2.0
|
||||
scale_curve = SubResource("CurveTexture_1w0c6")
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_mnfw7"]
|
||||
radius = 4.0
|
||||
|
||||
[node name="Character" type="CharacterBody2D"]
|
||||
collision_mask = 7
|
||||
collision_layer = 3
|
||||
floor_stop_on_slope = false
|
||||
floor_snap_length = 3.0
|
||||
platform_on_leave = 2
|
||||
script = ExtResource("1_c5ycp")
|
||||
savedInputsPath = "res://Player/Ghosts/GhostData/testGhostRecording.res"
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="."]
|
||||
zoom = Vector2(3, 3)
|
||||
position_smoothing_enabled = true
|
||||
position_smoothing_speed = 20.0
|
||||
script = ExtResource("2_yp33m")
|
||||
|
||||
[node name="BoxCollider" type="CollisionShape2D" parent="."]
|
||||
[node name="CircleCollider" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_jbiem")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
self_modulate = Color(0.678431, 0.298039, 1, 1)
|
||||
visibility_layer = 257
|
||||
z_index = 1
|
||||
rotation = 0.0123838
|
||||
texture = ExtResource("1_3vfyw")
|
||||
script = ExtResource("3_6plye")
|
||||
[node name="SquishDetection" type="Area2D" parent="."]
|
||||
|
||||
[node name="WallslidingUp" type="GPUParticles2D" parent="Sprite"]
|
||||
show_behind_parent = true
|
||||
top_level = true
|
||||
position = Vector2(-7.79423, 4.5)
|
||||
emitting = false
|
||||
process_material = SubResource("ParticleProcessMaterial_65t6y")
|
||||
[node name="CircleCollider" type="CollisionShape2D" parent="SquishDetection"]
|
||||
shape = SubResource("CircleShape2D_mnfw7")
|
||||
|
||||
[node name="WallslidingNeutral" type="GPUParticles2D" parent="Sprite"]
|
||||
show_behind_parent = true
|
||||
top_level = true
|
||||
position = Vector2(-7.79423, 4.5)
|
||||
emitting = false
|
||||
amount = 16
|
||||
process_material = SubResource("ParticleProcessMaterial_65t6y")
|
||||
|
||||
[node name="WallslidingDown" type="GPUParticles2D" parent="Sprite"]
|
||||
show_behind_parent = true
|
||||
top_level = true
|
||||
position = Vector2(-7.79423, 4.5)
|
||||
emitting = false
|
||||
amount = 24
|
||||
process_material = SubResource("ParticleProcessMaterial_65t6y")
|
||||
|
||||
[node name="Grapple" type="Node2D" parent="Sprite"]
|
||||
modulate = Color(0, 1, 0, 1)
|
||||
script = ExtResource("5_sv1u0")
|
||||
|
||||
[node name="GrappleCore" type="Sprite2D" parent="Sprite/Grapple"]
|
||||
texture = ExtResource("6_ismrc")
|
||||
|
||||
[connection signal="Jumped" from="." to="Sprite" 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"]
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
const SPEED = 400.0
|
||||
const SPEED = 500.0
|
||||
const ACCEL = 7.0
|
||||
var direction = 0
|
||||
var addedveloc = 0
|
||||
|
||||
const JUMP_VELOCITY = -450.0
|
||||
const MAX_JUMPS = 2
|
||||
const MAX_JUMPS = 1
|
||||
var jumps = MAX_JUMPS
|
||||
|
||||
var wallKayote = 0
|
||||
|
@ -15,14 +15,61 @@ const FALL_SPEED = -JUMP_VELOCITY
|
|||
var falling = false
|
||||
|
||||
var floorTime = 0
|
||||
var kayote = 0
|
||||
|
||||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
|
||||
var checkpointPos = Vector2.ZERO
|
||||
|
||||
@export var ghostMode = false
|
||||
var ghostFrame = 0
|
||||
var startPos = Vector2.ZERO
|
||||
|
||||
var can_move = true
|
||||
|
||||
@onready var camera = $Camera
|
||||
|
||||
@export var savedInputsPath : String
|
||||
var savedInputsRef = load(savedInputsPath)
|
||||
|
||||
var savedInputs = []
|
||||
|
||||
var wallPower = 0
|
||||
|
||||
var squishers = -1
|
||||
|
||||
func actionPressed(inp):
|
||||
if ghostMode:
|
||||
if inp in savedInputs[ghostFrame]:
|
||||
return true
|
||||
return false
|
||||
else:
|
||||
return Input.is_action_pressed(inp)
|
||||
|
||||
func actionJustPressed(inp):
|
||||
if ghostMode:
|
||||
if inp in savedInputs[ghostFrame] and not inp in savedInputs[ghostFrame - 1]:
|
||||
return true
|
||||
return false
|
||||
else:
|
||||
return Input.is_action_just_pressed(inp)
|
||||
|
||||
func getAxis(inp1, inp2):
|
||||
if ghostMode:
|
||||
var dir = 0
|
||||
if actionPressed("left"):
|
||||
dir -= 1
|
||||
if actionPressed("right"):
|
||||
dir += 1
|
||||
return clamp(dir, -1, 1)
|
||||
else:
|
||||
return Input.get_axis(inp1, inp2)
|
||||
|
||||
func isWallSliding():
|
||||
return is_on_wall_only() and direction
|
||||
|
||||
func getGravMulti():
|
||||
var axis = (gen.boolToNumb(Input.is_action_pressed("up"), 1))
|
||||
var axis = (gen.boolToNumb(actionPressed("up"), 1))
|
||||
if velocity.y < 0:
|
||||
return axis
|
||||
return 1
|
||||
|
@ -32,66 +79,208 @@ func launch(veloc):
|
|||
velocity.x = veloc
|
||||
|
||||
signal Jumped
|
||||
signal Died
|
||||
|
||||
var deathParticles = preload("res://Particles/Player/deathParticles.tscn")
|
||||
|
||||
func die():
|
||||
Died.emit()
|
||||
var parti = deathParticles.instantiate()
|
||||
parti.modulate = $Sprite.self_modulate
|
||||
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
|
||||
|
||||
func _ready():
|
||||
startPos = global_position
|
||||
if ghostMode:
|
||||
var rc = load(savedInputsPath)
|
||||
|
||||
if rc:
|
||||
var inputKeyRaw = rc["actions"]
|
||||
var frameDataRaw = rc["data"]
|
||||
|
||||
var inputKey = []
|
||||
var frameData = {}
|
||||
|
||||
for action in inputKeyRaw:
|
||||
inputKey.append(action)
|
||||
|
||||
for frame in frameDataRaw:
|
||||
frameData[frame] = {}
|
||||
for x in frameDataRaw[frame]:
|
||||
frameData[frame][x] = frameDataRaw[frame][x]
|
||||
var frameCount = gen.getRecordingFrameCount(frameData)
|
||||
|
||||
var held = []
|
||||
|
||||
for frame in range(frameCount):
|
||||
savedInputs.append([])
|
||||
if frameData.has(frame):
|
||||
for actID in frameData[frame]:
|
||||
var pressed = frameData[frame][actID]
|
||||
var inputName = inputKey[actID]
|
||||
if pressed == 1:
|
||||
held.append(inputName)
|
||||
elif inputName in held:
|
||||
held.remove_at(held.find(inputName))
|
||||
savedInputs[frame] += held
|
||||
|
||||
@onready var trail = $"Sprite/Trail"
|
||||
var ghosting = true
|
||||
|
||||
var ghostParti = preload("res://Particles/Ghosts/spawnParticles.tscn")
|
||||
|
||||
func spawnParti():
|
||||
var parti = ghostParti.instantiate()
|
||||
add_child(parti)
|
||||
parti.top_level = true
|
||||
parti.global_position = global_position
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
direction = round(Input.get_axis("left", "right"))
|
||||
|
||||
wallKayote -= delta
|
||||
|
||||
if not is_on_floor():
|
||||
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:
|
||||
floorTime += delta
|
||||
jumps = MAX_JUMPS
|
||||
falling = false
|
||||
|
||||
if isWallSliding():
|
||||
wallKayote = 0.2
|
||||
falling = false
|
||||
|
||||
if Input.is_action_just_pressed("respawn") or position.y > 5000:
|
||||
position = Vector2.ZERO
|
||||
if ghostFrame + 1 >= savedInputs.size() and ghostMode:
|
||||
ghostFrame = 0
|
||||
trail.points = []
|
||||
$Sprite.visible = false
|
||||
ghosting = false
|
||||
spawnParti()
|
||||
global_position = startPos
|
||||
velocity = Vector2.ZERO
|
||||
await get_tree().create_timer(3).timeout
|
||||
spawnParti()
|
||||
ghosting = true
|
||||
$Sprite.visible = true
|
||||
|
||||
if Input.is_action_just_pressed("jump"):
|
||||
if wallKayote > 0 and not is_on_floor():
|
||||
wallKayote /= 2
|
||||
if Input.is_action_pressed("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
|
||||
if (ghosting or !ghostMode) and can_move:
|
||||
var space_state = get_world_2d().direct_space_state
|
||||
|
||||
if ghostFrame == 0:
|
||||
spawnParti()
|
||||
ghostFrame += 1
|
||||
|
||||
direction = round(getAxis("left", "right"))
|
||||
|
||||
wallKayote -= delta
|
||||
|
||||
if not is_on_floor():
|
||||
if velocity.y < 2000:
|
||||
velocity.y += gravity * delta / getGravMulti()
|
||||
|
||||
floorTime = 0
|
||||
kayote -= delta
|
||||
else:
|
||||
kayote = 0.3
|
||||
floorTime += delta
|
||||
jumps = MAX_JUMPS
|
||||
falling = false
|
||||
|
||||
if Input.is_action_just_pressed("down") and not falling and not isWallSliding():
|
||||
falling = true
|
||||
velocity.y = clamp(velocity.y + FALL_SPEED, FALL_SPEED, INF)
|
||||
|
||||
if isWallSliding():
|
||||
var upDown = clamp(Input.get_axis("up", "down"), -0.5, 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
|
||||
if isWallSliding():
|
||||
wallKayote = 0.3
|
||||
falling = false
|
||||
|
||||
addedveloc = lerpf(addedveloc, 0, delta * 5)
|
||||
if actionJustPressed("respawn") or position.y > 5000:
|
||||
die()
|
||||
|
||||
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 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)
|
||||
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()
|
||||
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
|
||||
if kayote < 0:
|
||||
jumps -= 1
|
||||
else:
|
||||
var query = PhysicsRayQueryParameters2D.create(global_position + (Vector2.UP * 32), global_position + (Vector2.DOWN * 64))
|
||||
query.exclude = [self]
|
||||
var result = space_state.intersect_ray(query)
|
||||
|
||||
if result and "velocity" in result.collider:
|
||||
velocity += result.collider.velocity
|
||||
|
||||
falling = false
|
||||
if actionPressed("down") and not is_on_floor() and kayote > 0:
|
||||
launch(direction * SPEED * 1.75)
|
||||
kayote = 0
|
||||
|
||||
if actionJustPressed("down") and not falling and not isWallSliding():
|
||||
falling = true
|
||||
velocity.y = clamp(velocity.y + FALL_SPEED, FALL_SPEED, INF)
|
||||
|
||||
if isWallSliding():
|
||||
var upDown = clamp(getAxis("up", "down"), -0.5, 1)
|
||||
var holdMulti = (upDown * 2) + 1
|
||||
|
||||
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:
|
||||
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()
|
||||
move_and_slide()
|
||||
|
||||
func _process(delta):
|
||||
if ghostMode:
|
||||
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)
|
||||
|
||||
|
||||
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):
|
||||
squishers -= 1
|
||||
print("Unsquish :(")
|
||||
|
|
69
Player/BasicCharacter/sprite.tscn
Normal file
69
Player/BasicCharacter/sprite.tscn
Normal file
|
@ -0,0 +1,69 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bl4g0ao3b8b6p"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dvx8lliqdi3dv" path="res://Player/Skins/Square/Square.png" id="1_k2mt0"]
|
||||
[ext_resource type="Script" path="res://Player/BasicCharacter/AnimationController.gd" id="2_laadp"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_ky2t4"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.738916, 0), -1.78462, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_1w0c6"]
|
||||
curve = SubResource("Curve_ky2t4")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_65t6y"]
|
||||
particle_flag_align_y = true
|
||||
particle_flag_disable_z = true
|
||||
particle_flag_damping_as_friction = true
|
||||
direction = Vector3(0, -1, 0)
|
||||
initial_velocity_min = 34.78
|
||||
initial_velocity_max = 34.78
|
||||
gravity = Vector3(0, 250, 0)
|
||||
scale_min = 2.0
|
||||
scale_max = 2.0
|
||||
scale_curve = SubResource("CurveTexture_1w0c6")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_rdcm5"]
|
||||
_data = [Vector2(0, 0), -4.02276, 4.38034, 0, 0, Vector2(1, 1), -0.0750911, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_rfqd0"]
|
||||
interpolation_mode = 2
|
||||
colors = PackedColorArray(1, 1, 1, 0, 0, 1, 1, 1)
|
||||
|
||||
[node name="Sprite" type="Sprite2D"]
|
||||
visibility_layer = 257
|
||||
z_index = 10
|
||||
texture = ExtResource("1_k2mt0")
|
||||
script = ExtResource("2_laadp")
|
||||
|
||||
[node name="WallslidingUp" type="GPUParticles2D" parent="."]
|
||||
show_behind_parent = true
|
||||
top_level = true
|
||||
position = Vector2(-7.79423, 4.5)
|
||||
emitting = false
|
||||
process_material = SubResource("ParticleProcessMaterial_65t6y")
|
||||
|
||||
[node name="WallslidingNeutral" type="GPUParticles2D" parent="."]
|
||||
show_behind_parent = true
|
||||
top_level = true
|
||||
position = Vector2(-7.79423, 4.5)
|
||||
emitting = false
|
||||
amount = 16
|
||||
process_material = SubResource("ParticleProcessMaterial_65t6y")
|
||||
|
||||
[node name="WallslidingDown" type="GPUParticles2D" parent="."]
|
||||
show_behind_parent = true
|
||||
top_level = true
|
||||
position = Vector2(-7.79423, 4.5)
|
||||
emitting = false
|
||||
amount = 24
|
||||
process_material = SubResource("ParticleProcessMaterial_65t6y")
|
||||
|
||||
[node name="Trail" type="Line2D" parent="."]
|
||||
top_level = true
|
||||
texture_filter = 2
|
||||
width = 5.0
|
||||
width_curve = SubResource("Curve_rdcm5")
|
||||
default_color = Color(0, 1, 1, 1)
|
||||
gradient = SubResource("Gradient_rfqd0")
|
||||
end_cap_mode = 2
|
|
@ -8,7 +8,9 @@ func _process(delta):
|
|||
var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000)
|
||||
var direction = clamp(player.velocity.x, -1, 1)
|
||||
|
||||
speedMod = lerpf(speedMod, velocModifier * direction / 10, delta * 20)
|
||||
speedMod = lerpf(speedMod, velocModifier * direction / 5, delta * 10)
|
||||
|
||||
position = (get_local_mouse_position() / 3)
|
||||
zoom = Vector2.ONE * 3 * get_viewport().size.length() / 3000
|
||||
|
||||
position = (get_local_mouse_position() / 2.5)
|
||||
position.x += speedMod
|
||||
|
|
42
Player/DebugTrail/Recorder.gd
Normal file
42
Player/DebugTrail/Recorder.gd
Normal file
|
@ -0,0 +1,42 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var player = get_parent()
|
||||
@onready var sprite = player.find_child("Sprite")
|
||||
@export var tracking = false
|
||||
var active = false
|
||||
@export var finished = false
|
||||
|
||||
@export var saved = []
|
||||
|
||||
#func _ready():
|
||||
#await get_tree().create_timer(30).timeout
|
||||
#finished = true
|
||||
|
||||
func track():
|
||||
saved.append(gen.getCurrentActions())
|
||||
|
||||
func _physics_process(delta):
|
||||
if tracking:
|
||||
track()
|
||||
|
||||
if finished:
|
||||
print("TIME!!!!")
|
||||
var dict = {"actions": [], "data": {}}
|
||||
|
||||
for frameNumb in len(saved):
|
||||
var frame = saved[frameNumb]
|
||||
for action in frame:
|
||||
if not action in dict.actions:
|
||||
dict.actions.append(action)
|
||||
var actID = dict.actions.find(action)
|
||||
if not frameNumb in dict.data:
|
||||
dict.data[frameNumb] = {}
|
||||
dict.data[frameNumb][actID] = frame[action]
|
||||
|
||||
dict.data[saved.size() - 1] = {}
|
||||
|
||||
var packed = PackedDataContainer.new()
|
||||
packed.pack(dict)
|
||||
ResourceSaver.save(packed, "ghostRecording.res")
|
||||
|
||||
queue_free()
|
|
@ -1,7 +1,6 @@
|
|||
extends Control
|
||||
|
||||
@onready var player = $"../../"
|
||||
@onready var grapple = $"../../Sprite/Grapple"
|
||||
|
||||
@onready var velocNumb = $"Velocity"
|
||||
@onready var horzVeloc = $"HorzVeloc"
|
||||
|
@ -16,4 +15,7 @@ func _physics_process(delta):
|
|||
vertVeloc.text = "Vertical Velocity: " + str(round(player.velocity.y))
|
||||
addedVeloc.text = "Added Velocity: " + str(round(abs(player.addedveloc)))
|
||||
jumps.text = "Jumps: " + str(player.jumps)
|
||||
grapples.text = "Grapples: " + str(grapple.grapples)
|
||||
if player.find_child("Grapple"):
|
||||
grapples.text = "Grapples: " + str(player.find_child("Grapple").grapples)
|
||||
func _process(delta):
|
||||
size = get_viewport().size
|
||||
|
|
228
Player/Ghosts/CharacterGhost.tscn
Normal file
228
Player/Ghosts/CharacterGhost.tscn
Normal file
|
@ -0,0 +1,228 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://c4x2fbs6bvxpp"]
|
||||
|
||||
[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
|
||||
|
||||
[sub_resource type="Curve" id="Curve_hemgx"]
|
||||
min_value = -2.0
|
||||
max_value = 2.0
|
||||
_data = [Vector2(0, 0.0219781), 0.0, 4.98626, 0, 0, Vector2(1, 0.989011), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_12hes"]
|
||||
curve = SubResource("Curve_hemgx")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_8o02i"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_ibtln"]
|
||||
curve = SubResource("Curve_8o02i")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_6e1l2"]
|
||||
particle_flag_align_y = true
|
||||
particle_flag_disable_z = true
|
||||
direction = Vector3(0, 0, 0)
|
||||
spread = 180.0
|
||||
initial_velocity_min = 150.0
|
||||
initial_velocity_max = 150.0
|
||||
orbit_velocity_min = -0.5
|
||||
orbit_velocity_max = 0.5
|
||||
orbit_velocity_curve = SubResource("CurveTexture_12hes")
|
||||
gravity = Vector3(0, 0, 0)
|
||||
damping_min = 50.0
|
||||
damping_max = 50.0
|
||||
scale_min = 3.0
|
||||
scale_max = 3.0
|
||||
scale_curve = SubResource("CurveTexture_ibtln")
|
||||
|
||||
[node name="Character" type="CharacterBody2D"]
|
||||
collision_layer = 3
|
||||
floor_stop_on_slope = false
|
||||
floor_snap_length = 3.0
|
||||
script = SubResource("GDScript_nkjkv")
|
||||
|
||||
[node name="BoxCollider" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_jbiem")
|
||||
|
||||
[node name="Sprite" parent="." instance=ExtResource("2_mjdr3")]
|
||||
modulate = Color(0, 1, 1, 1)
|
||||
|
||||
[node name="SpawnParticles" type="GPUParticles2D" parent="."]
|
||||
modulate = Color(0, 1, 1, 1)
|
||||
emitting = false
|
||||
amount = 20
|
||||
process_material = SubResource("ParticleProcessMaterial_6e1l2")
|
||||
lifetime = 2.0
|
||||
one_shot = true
|
||||
speed_scale = 1.5
|
||||
explosiveness = 1.0
|
||||
fixed_fps = 0
|
||||
interpolate = false
|
BIN
Player/Ghosts/GhostData/Level1HighJumpTutorial.res
Normal file
BIN
Player/Ghosts/GhostData/Level1HighJumpTutorial.res
Normal file
Binary file not shown.
BIN
Player/Ghosts/GhostData/Level1JumpTutorial.res
Normal file
BIN
Player/Ghosts/GhostData/Level1JumpTutorial.res
Normal file
Binary file not shown.
BIN
Player/Ghosts/GhostData/Level1WallJumpTutorial.res
Normal file
BIN
Player/Ghosts/GhostData/Level1WallJumpTutorial.res
Normal file
Binary file not shown.
BIN
Player/Ghosts/GhostData/Level1WallJumpTutorial2.res
Normal file
BIN
Player/Ghosts/GhostData/Level1WallJumpTutorial2.res
Normal file
Binary file not shown.
BIN
Player/Ghosts/GhostData/MovementTutorial.res
Normal file
BIN
Player/Ghosts/GhostData/MovementTutorial.res
Normal file
Binary file not shown.
|
@ -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="."]
|
||||
|
|
BIN
Player/Lighting/CircleLight.kra
Normal file
BIN
Player/Lighting/CircleLight.kra
Normal file
Binary file not shown.
BIN
Player/Lighting/CircleLight.kra~
Normal file
BIN
Player/Lighting/CircleLight.kra~
Normal file
Binary file not shown.
BIN
Player/Lighting/CircleLight.png~
Normal file
BIN
Player/Lighting/CircleLight.png~
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
4
Player/Lighting/EnableInGame.gd
Normal file
4
Player/Lighting/EnableInGame.gd
Normal file
|
@ -0,0 +1,4 @@
|
|||
extends PointLight2D
|
||||
|
||||
func _ready():
|
||||
enabled = true
|
Loading…
Add table
Add a link
Reference in a new issue