Better lava
15
Core/Scripts/Fader.gd
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
extends CanvasLayer
|
||||||
|
|
||||||
|
@onready var fader = $Fader
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_viewport().connect("size_changed", _on_viewport_resize)
|
||||||
|
_on_viewport_resize()
|
||||||
|
|
||||||
|
func _on_viewport_resize():
|
||||||
|
fader.texture.width = get_viewport().size.x
|
||||||
|
fader.position.y = -get_viewport().size.y
|
||||||
|
fader.texture.height = get_viewport().size.y
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
|
@ -1,5 +1,7 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
var savedPos = Vector2.ZERO
|
||||||
|
|
||||||
func boolToNumb(val, offset=0):
|
func boolToNumb(val, offset=0):
|
||||||
return float(val) + offset
|
return float(val) + offset
|
||||||
|
|
||||||
|
|
4
Core/Scripts/music.gd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends AudioStreamPlayer
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
play()
|
756
Maps/Level1/Level1.tscn
Normal file
BIN
Maps/Level1/Music/Alarm.wav
Normal file
24
Maps/Level1/Music/Alarm.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://b1qas0bjgk2f5"
|
||||||
|
path="res://.godot/imported/Alarm.wav-f12555f72130d7f82d4f92cce1a1977d.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Maps/Level1/Music/Alarm.wav"
|
||||||
|
dest_files=["res://.godot/imported/Alarm.wav-f12555f72130d7f82d4f92cce1a1977d.sample"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
force/8_bit=false
|
||||||
|
force/mono=false
|
||||||
|
force/max_rate=false
|
||||||
|
force/max_rate_hz=44100
|
||||||
|
edit/trim=false
|
||||||
|
edit/normalize=false
|
||||||
|
edit/loop_mode=0
|
||||||
|
edit/loop_begin=0
|
||||||
|
edit/loop_end=-1
|
||||||
|
compress/mode=0
|
|
@ -6,5 +6,7 @@ extends Area2D
|
||||||
|
|
||||||
var animReady = false
|
var animReady = false
|
||||||
|
|
||||||
func _on_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
func _on_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
|
||||||
animator.play(animation)
|
animator.play(animation)
|
||||||
|
if playOnce:
|
||||||
|
queue_free()
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
extends Node2D
|
extends Area2D
|
||||||
|
|
||||||
|
func _on_body_shape_entered(_body_rid, body, _body_shape_index, _local_shape_index):
|
||||||
# Called when the node enters the scene tree for the first time.
|
if "checkpointPos" in body:
|
||||||
func _ready():
|
body.checkpointPos = body.global_position
|
||||||
pass # Replace with function body.
|
queue_free()
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
[gd_scene format=3 uid="uid://dep314vkturtp"]
|
[gd_scene load_steps=3 format=3 uid="uid://dep314vkturtp"]
|
||||||
|
|
||||||
[node name="Checkpoint" type="Node2D"]
|
[ext_resource type="Script" path="res://Objects/Checkpoint/Checkpoint.gd" id="1_63qyw"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4a0ws"]
|
||||||
|
|
||||||
|
[node name="Checkpoint" type="Area2D"]
|
||||||
|
script = ExtResource("1_63qyw")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_4a0ws")
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="." to="." method="_on_body_shape_entered"]
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
var detecting = true
|
var detecting = true
|
||||||
|
@export var once = false
|
||||||
|
|
||||||
func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
func _on_anim_trigger_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
|
||||||
if detecting:
|
if detecting:
|
||||||
detecting = false
|
detecting = false
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local
|
||||||
|
|
||||||
await tween.finished
|
await tween.finished
|
||||||
|
|
||||||
|
if not once:
|
||||||
tween = get_tree().create_tween()
|
tween = get_tree().create_tween()
|
||||||
tween.set_ease(Tween.EASE_IN)
|
tween.set_ease(Tween.EASE_IN)
|
||||||
tween.set_trans(Tween.TRANS_SINE)
|
tween.set_trans(Tween.TRANS_SINE)
|
||||||
|
@ -27,4 +29,6 @@ func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local
|
||||||
await tween.finished
|
await tween.finished
|
||||||
|
|
||||||
detecting = true
|
detecting = true
|
||||||
|
else:
|
||||||
|
$AnimTrigger.queue_free()
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="2_6f7iw"]
|
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="2_6f7iw"]
|
||||||
|
|
||||||
[node name="Smasher" type="Node2D"]
|
[node name="Smasher" type="Node2D"]
|
||||||
|
z_index = -1
|
||||||
script = ExtResource("1_px0wu")
|
script = ExtResource("1_px0wu")
|
||||||
|
|
||||||
[node name="AnimTrigger" parent="." instance=ExtResource("1_cq28h")]
|
[node name="AnimTrigger" parent="." instance=ExtResource("1_cq28h")]
|
||||||
|
|
BIN
Objects/GroundSmasher/SmashWarning.kra
Normal file
BIN
Objects/GroundSmasher/SmashWarning.kra~
Normal file
BIN
Objects/GroundSmasher/SmashWarning.png
Normal file
After Width: | Height: | Size: 400 B |
34
Objects/GroundSmasher/SmashWarning.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cdxsc8kilrmvb"
|
||||||
|
path="res://.godot/imported/SmashWarning.png-6c070f1d5606019cc656f33507b9688b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/GroundSmasher/SmashWarning.png"
|
||||||
|
dest_files=["res://.godot/imported/SmashWarning.png-6c070f1d5606019cc656f33507b9688b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
Objects/GroundSmasher/SmashWarning.png~
Normal file
After Width: | Height: | Size: 395 B |
|
@ -1,6 +1,10 @@
|
||||||
extends AnimatableBody2D
|
extends AnimatableBody2D
|
||||||
|
|
||||||
@onready var tip = $"Tip"
|
@onready var tip = $"Tip"
|
||||||
|
@onready var warnSign = $"../WarnSign"
|
||||||
|
@onready var warnBorder = $"../WarnBorder"
|
||||||
|
|
||||||
|
@export var once = false
|
||||||
|
|
||||||
var detecting = true
|
var detecting = true
|
||||||
|
|
||||||
|
@ -8,8 +12,9 @@ var velocity = Vector2.ZERO
|
||||||
|
|
||||||
@onready var startPos = global_position
|
@onready var startPos = global_position
|
||||||
|
|
||||||
func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
func _on_anim_trigger_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
|
||||||
if detecting:
|
if detecting:
|
||||||
|
|
||||||
detecting = false
|
detecting = false
|
||||||
var tween = get_tree().create_tween()
|
var tween = get_tree().create_tween()
|
||||||
var space_state = get_world_2d().direct_space_state
|
var space_state = get_world_2d().direct_space_state
|
||||||
|
@ -21,20 +26,48 @@ func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local
|
||||||
if result:
|
if result:
|
||||||
finalPos = result.position - tip.global_position
|
finalPos = result.position - tip.global_position
|
||||||
|
|
||||||
|
warnBorder.points[0] = Vector2(15.5, -0.25)
|
||||||
|
warnBorder.points[1] = Vector2(-15.5, -0.25)
|
||||||
|
warnBorder.points[3] = Vector2(15.5, (finalPos.length() / $"../".scale.y) + 4.5)
|
||||||
|
warnBorder.points[2] = Vector2(-15.5, (finalPos.length() / $"../".scale.y) + 4.5)
|
||||||
|
|
||||||
|
warnSign.global_rotation = 0
|
||||||
|
warnSign.global_position = tip.global_position + (finalPos / 2) + Vector2(0, 4.5).rotated(global_rotation)
|
||||||
|
|
||||||
tween.set_trans(Tween.TRANS_CUBIC)
|
tween.set_trans(Tween.TRANS_CUBIC)
|
||||||
|
tween.set_ease(Tween.EASE_IN)
|
||||||
|
|
||||||
tween.set_parallel(true)
|
tween.set_parallel(true)
|
||||||
|
tween.tween_property(self, "global_position", global_position + finalPos, 0.4).set_delay(0.05)
|
||||||
|
tween.tween_property(self, "velocity", Vector2(0, 400).rotated(global_rotation), 0.4).set_ease(Tween.EASE_OUT)
|
||||||
|
|
||||||
tween.tween_property(self, "global_position", global_position + finalPos, 0.5).set_ease(Tween.EASE_IN)
|
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 255), 0.3).set_ease(Tween.EASE_OUT)
|
||||||
tween.tween_property(self, "velocity", Vector2(0, 700).rotated(global_rotation), 0.5).set_ease(Tween.EASE_IN)
|
tween.tween_property(warnBorder, "modulate", Color8(255, 0, 0, 255), 0.3).set_ease(Tween.EASE_OUT)
|
||||||
|
tween.chain()
|
||||||
|
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 0), 0.5).set_ease(Tween.EASE_IN)
|
||||||
|
tween.tween_property(warnBorder, "modulate", Color8(255, 0, 0, 0), 0.5).set_ease(Tween.EASE_IN)
|
||||||
|
|
||||||
await tween.finished
|
if not once:
|
||||||
|
await get_tree().create_timer(0.5).timeout
|
||||||
|
|
||||||
|
var launcherHitbox = $Tip/LauncherHitbox
|
||||||
|
var hitTable = launcherHitbox.get_overlapping_bodies()
|
||||||
|
for object in hitTable:
|
||||||
|
if object is CharacterBody2D and "velocity" in object and object.has_method("forceLaunch"):
|
||||||
|
object.forceLaunch(velocity.x * 3)
|
||||||
|
#object.velocity.y = velocity.y * 1.5
|
||||||
|
if velocity.x < 5:
|
||||||
|
object.forceLowGrav = true
|
||||||
|
|
||||||
tween = get_tree().create_tween()
|
tween = get_tree().create_tween()
|
||||||
tween.set_parallel(true)
|
tween.set_parallel(true)
|
||||||
|
tween.set_trans(Tween.TRANS_SINE)
|
||||||
|
tween.set_ease(Tween.EASE_IN)
|
||||||
|
|
||||||
tween.tween_property(self, "global_position", startPos, 2).set_trans(Tween.TRANS_SINE).set_delay(1).set_ease(Tween.EASE_IN)
|
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 0), 0.6)
|
||||||
tween.tween_property(self, "velocity", Vector2.ZERO, 0.5).set_trans(Tween.TRANS_SINE).set_delay(0.25).set_ease(Tween.EASE_IN)
|
|
||||||
|
tween.tween_property(self, "global_position", startPos, 1).set_delay(0.5)
|
||||||
|
tween.tween_property(self, "velocity", Vector2.ZERO, 0.5).set_delay(0.25)
|
||||||
|
|
||||||
#await get_tree().create_timer(0.25).timeout
|
#await get_tree().create_timer(0.25).timeout
|
||||||
|
|
||||||
|
@ -44,3 +77,6 @@ func _on_anim_trigger_body_shape_entered(body_rid, body, body_shape_index, local
|
||||||
|
|
||||||
detecting = true
|
detecting = true
|
||||||
|
|
||||||
|
#func _on_launcher_hitbox_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
||||||
|
#if "velocity" in body:
|
||||||
|
#body.velocity /= 10
|
||||||
|
|
BIN
Objects/GroundSmasher/WarningSymbol.kra
Normal file
BIN
Objects/GroundSmasher/WarningSymbol.kra~
Normal file
BIN
Objects/GroundSmasher/WarningSymbol.png
Normal file
After Width: | Height: | Size: 525 B |
34
Objects/GroundSmasher/WarningSymbol.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://3gsjdgvlscl"
|
||||||
|
path="res://.godot/imported/WarningSymbol.png-e83b2301a93ca928f881077d9da41541.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/GroundSmasher/WarningSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/WarningSymbol.png-e83b2301a93ca928f881077d9da41541.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
Objects/GroundSmasher/WarningSymbol.png~
Normal file
After Width: | Height: | Size: 540 B |
|
@ -1,8 +1,12 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://c7vbin1wckti1"]
|
[gd_scene load_steps=6 format=3 uid="uid://c7vbin1wckti1"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dc8odchuhx80d" path="res://Objects/AnimTrigger/anim_trigger.tscn" id="1_qvh2l"]
|
[ext_resource type="PackedScene" uid="uid://dc8odchuhx80d" path="res://Objects/AnimTrigger/anim_trigger.tscn" id="1_qvh2l"]
|
||||||
[ext_resource type="Script" path="res://Objects/GroundSmasher/SmasherCollide.gd" id="2_0g66p"]
|
[ext_resource type="Script" path="res://Objects/GroundSmasher/SmasherCollide.gd" id="3_2qfts"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="2_s8d83"]
|
[ext_resource type="Texture2D" uid="uid://3gsjdgvlscl" path="res://Objects/GroundSmasher/WarningSymbol.png" id="4_5psq0"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="4_kj73c"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pnc2c"]
|
||||||
|
size = Vector2(30, 10)
|
||||||
|
|
||||||
[node name="Smasher" type="Node2D"]
|
[node name="Smasher" type="Node2D"]
|
||||||
|
|
||||||
|
@ -12,19 +16,37 @@ collision_layer = 2
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
script = null
|
script = null
|
||||||
|
|
||||||
[node name="SmasherBody" type="AnimatableBody2D" parent="."]
|
[node name="WarnSign" type="Sprite2D" parent="."]
|
||||||
position = Vector2(0, -137)
|
modulate = Color(1, 1, 1, 0)
|
||||||
script = ExtResource("2_0g66p")
|
show_behind_parent = true
|
||||||
|
scale = Vector2(0.5, 0.5)
|
||||||
|
texture = ExtResource("4_5psq0")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="SmasherBody"]
|
[node name="WarnBorder" type="Line2D" parent="."]
|
||||||
texture = ExtResource("2_s8d83")
|
modulate = Color(1, 0, 0, 0)
|
||||||
offset = Vector2(0, 40)
|
position = Vector2(0, -39)
|
||||||
|
points = PackedVector2Array(-15.5, 0, 15.5, 0, 15.5, 78.5, -15.5, 78.5)
|
||||||
|
closed = true
|
||||||
|
width = 1.25
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SmasherBody"]
|
[node name="Crusher" type="AnimatableBody2D" parent="."]
|
||||||
position = Vector2(0, 24)
|
position = Vector2(0, -97)
|
||||||
polygon = PackedVector2Array(-16, -47, -16, 73, -13, 79, 13, 79, 16, 73, 16, -47)
|
script = ExtResource("3_2qfts")
|
||||||
|
|
||||||
[node name="Tip" type="Node2D" parent="SmasherBody"]
|
[node name="Sprite" type="Sprite2D" parent="Crusher"]
|
||||||
position = Vector2(0, 103)
|
modulate = Color(0, 0, 1, 1)
|
||||||
|
texture = ExtResource("4_kj73c")
|
||||||
|
|
||||||
[connection signal="body_shape_entered" from="AnimTrigger" to="SmasherBody" method="_on_anim_trigger_body_shape_entered"]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Crusher"]
|
||||||
|
polygon = PackedVector2Array(-13, 63, -16, 63, -16, -63, 16, -63, 16, 57, 16, 63, 13, 63)
|
||||||
|
|
||||||
|
[node name="Tip" type="Node2D" parent="Crusher"]
|
||||||
|
position = Vector2(0, 63)
|
||||||
|
|
||||||
|
[node name="LauncherHitbox" type="Area2D" parent="Crusher/Tip"]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Crusher/Tip/LauncherHitbox"]
|
||||||
|
shape = SubResource("RectangleShape2D_pnc2c")
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="AnimTrigger" to="Crusher" method="_on_anim_trigger_body_shape_entered"]
|
||||||
|
[connection signal="body_shape_entered" from="Crusher/Tip/LauncherHitbox" to="Crusher" method="_on_launcher_hitbox_body_shape_entered"]
|
||||||
|
|
37
Objects/Lava/Lava.gd
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var enabled = false
|
||||||
|
@onready var player = $"../../Character"
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
if enabled:
|
||||||
|
#position.y -= delta * (35 + clamp(abs(player.global_position.y) - abs(global_position.y) - 500, 0, INF))
|
||||||
|
global_position.y = lerpf(global_position.y, max(player.global_position.y - 100, -8425), delta / 5)
|
||||||
|
|
||||||
|
visible = true
|
||||||
|
$Particles.emitting = true
|
||||||
|
if global_position.y <= -8425:
|
||||||
|
enabled = false
|
||||||
|
var alarmSync = roundi(fmod(Music.get_playback_position(), 1.86))
|
||||||
|
if player.global_position.y < -8425 and Music.get_playback_position() < 59.1 and alarmSync == 2 and (Music.get_playback_position() < 33 or Music.get_playback_position() > 54):
|
||||||
|
Music.seek(59)
|
||||||
|
elif player.global_position.y > -8425 and Music.get_playback_position() > 59.1:
|
||||||
|
Music.seek(18.5)
|
||||||
|
#if enabled:
|
||||||
|
#enabled = false
|
||||||
|
#var tween = create_tween()
|
||||||
|
#tween.tween_property(self, "global_position", global_position - Vector2(0, 000), 68)
|
||||||
|
#visible = true
|
||||||
|
#$Particles.emitting = true
|
||||||
|
#print(tween)
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
$LavaSprite.region_rect.position.x = fmod($LavaSprite.region_rect.position.x + delta * 100, 64)
|
||||||
|
|
||||||
|
func _on_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
||||||
|
if body.has_method("die"):
|
||||||
|
Music.stop()
|
||||||
|
body.die()
|
BIN
Objects/Lava/Lava.png
Normal file
After Width: | Height: | Size: 315 B |
34
Objects/Lava/Lava.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c0whh5ogd1d6u"
|
||||||
|
path="res://.godot/imported/Lava.png-12ee5be03fffb3ac1b8fafd48d63e347.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/Lava/Lava.png"
|
||||||
|
dest_files=["res://.godot/imported/Lava.png-12ee5be03fffb3ac1b8fafd48d63e347.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
Objects/LavaButton/Button.kra
Normal file
BIN
Objects/LavaButton/Button.kra-autosave.kra
Normal file
BIN
Objects/LavaButton/Button.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
34
Objects/LavaButton/Button.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c5ytge77dxip1"
|
||||||
|
path="res://.godot/imported/Button.png-5e7d379d4ed4195cd53844d12167b92b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/LavaButton/Button.png"
|
||||||
|
dest_files=["res://.godot/imported/Button.png-5e7d379d4ed4195cd53844d12167b92b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
Objects/LavaButton/Button.png~
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Objects/LavaButton/Explosion.ogv
Normal file
52
Objects/LavaButton/LavaButton.gd
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
extends StaticBody2D
|
||||||
|
|
||||||
|
const alarm = preload("res://Maps/Level1/Music/Alarm.wav")
|
||||||
|
|
||||||
|
func _on_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
||||||
|
if "can_move" in body:
|
||||||
|
$CutsceneDetection.queue_free()
|
||||||
|
body.can_move = false
|
||||||
|
$Squeak.play()
|
||||||
|
var tween = create_tween()
|
||||||
|
#scale.y /= 2
|
||||||
|
#position.y += 48
|
||||||
|
|
||||||
|
await get_tree().create_timer(2).timeout
|
||||||
|
#scale.y *= 2
|
||||||
|
#position.y -= 48
|
||||||
|
|
||||||
|
body.can_move = true
|
||||||
|
$Sprite.queue_free()
|
||||||
|
$Collider.queue_free()
|
||||||
|
var video : VideoStreamPlayer = $Explosion
|
||||||
|
video.play()
|
||||||
|
#await video.finished
|
||||||
|
var tilemap : TileMap = $"../TileMap"
|
||||||
|
var player = $"../../Character"
|
||||||
|
var sprite = player.find_child("Sprite")
|
||||||
|
var light = player.find_child("LightSource")
|
||||||
|
var vignette = Camera.find_child("Dark")
|
||||||
|
var background = $"../ParallaxBackground/ParallaxLayer"
|
||||||
|
tween = create_tween()
|
||||||
|
tween.set_parallel(true)
|
||||||
|
tween.set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_CUBIC)
|
||||||
|
tween.tween_property(sprite, "self_modulate", Color8(100, 150, 255), 11)
|
||||||
|
tween.tween_property(background, "modulate", Color8(25, 0, 0), 11)
|
||||||
|
tween.tween_property(tilemap, "modulate", Color8(200, 0, 0), 11)
|
||||||
|
tween.tween_property(light, "energy", .15, 11)
|
||||||
|
tween.tween_property(vignette, "energy", 1.5, 11)
|
||||||
|
tween.tween_property(vignette, "texture_scale", .5, 11)
|
||||||
|
tween.tween_property(Camera, "zoom", Camera.zoom * 1.5, 11)
|
||||||
|
tween.chain()
|
||||||
|
tween.set_ease(Tween.EASE_OUT)
|
||||||
|
tween.tween_property(Camera, "zoom", Camera.resetZoom(), 1)
|
||||||
|
tween.tween_property(vignette, "texture_scale", 3 , 1)
|
||||||
|
tween.tween_property(vignette, "energy", 0 , 2)
|
||||||
|
tween.tween_property(light, "energy", 0 , 1)
|
||||||
|
Music.stream = alarm
|
||||||
|
Music.play()
|
||||||
|
await tween.finished
|
||||||
|
$"../Lava".enabled = true
|
||||||
|
|
||||||
|
queue_free()
|
||||||
|
|
BIN
Objects/LavaButton/Squeak.wav
Normal file
24
Objects/LavaButton/Squeak.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://bj6ei616sdyqi"
|
||||||
|
path="res://.godot/imported/Squeak.wav-3d7d9c2b00ed5f4753a1e54ca1fc2ec1.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/LavaButton/Squeak.wav"
|
||||||
|
dest_files=["res://.godot/imported/Squeak.wav-3d7d9c2b00ed5f4753a1e54ca1fc2ec1.sample"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
force/8_bit=false
|
||||||
|
force/mono=false
|
||||||
|
force/max_rate=false
|
||||||
|
force/max_rate_hz=44100
|
||||||
|
edit/trim=true
|
||||||
|
edit/normalize=false
|
||||||
|
edit/loop_mode=0
|
||||||
|
edit/loop_begin=0
|
||||||
|
edit/loop_end=-1
|
||||||
|
compress/mode=0
|
11
Objects/LavaButton/button.tscn
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://uscernaqw5ll"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c5ytge77dxip1" path="res://Objects/LavaButton/Button.png" id="1_3hvsu"]
|
||||||
|
|
||||||
|
[node name="LavaButton" type="StaticBody2D"]
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_3hvsu")
|
||||||
|
|
||||||
|
[node name="Collider" type="CollisionPolygon2D" parent="."]
|
||||||
|
polygon = PackedVector2Array(-38, 15, -38, -2, -34, -12, -24, -16, 24, -16, 34, -12, 38, -2, 38, 15, 55, 15, 61, 18, 64, 24, 64, 32, -64, 32, -64, 24, -61, 18, -55, 15)
|
28
Objects/MovingPlatform/MovingPlatform.gd
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
extends AnimatableBody2D
|
||||||
|
|
||||||
|
@export var endPoint : Vector2
|
||||||
|
var velocity = Vector2.ZERO
|
||||||
|
|
||||||
|
var moving = false
|
||||||
|
|
||||||
|
func _on_area_2d_body_shape_entered(body_rid, body, bod_shape_index, local_shape_index):
|
||||||
|
if not moving:
|
||||||
|
moving = true
|
||||||
|
var tween = create_tween()
|
||||||
|
|
||||||
|
tween.set_parallel(true)
|
||||||
|
|
||||||
|
tween.set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_SINE)
|
||||||
|
|
||||||
|
var dur = position.distance_to(position + endPoint) / 750
|
||||||
|
|
||||||
|
tween.tween_property(self, "position", position + endPoint, dur)
|
||||||
|
tween.tween_property(self, "velocity", endPoint / dur / 3, dur / 2)
|
||||||
|
tween.tween_property(self, "velocity", Vector2.ZERO, 1.25).set_delay((dur / 2))
|
||||||
|
tween.chain()
|
||||||
|
tween.tween_property(self, "position", position, dur).set_delay(2)
|
||||||
|
tween.tween_property(self, "velocity", -endPoint / 3, 1).set_delay(2)
|
||||||
|
tween.tween_property(self, "velocity", Vector2.ZERO, 1.25).set_delay(3)
|
||||||
|
|
||||||
|
await tween.finished
|
||||||
|
moving = false
|
29
Objects/MovingPlatform/MovingPlatform.tscn
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://vfpfao4e18vn"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Objects/MovingPlatform/MovingPlatform.gd" id="1_01pul"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bwj4inpj7mawo" path="res://Objects/MovingPlatform/Sprite.png" id="1_1t8bc"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_o874y"]
|
||||||
|
size = Vector2(128, 32)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yhojp"]
|
||||||
|
size = Vector2(128, 30)
|
||||||
|
|
||||||
|
[node name="MovingPlatform" type="AnimatableBody2D"]
|
||||||
|
script = ExtResource("1_01pul")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_1t8bc")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_o874y")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="."]
|
||||||
|
position = Vector2(0, -10)
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||||
|
shape = SubResource("RectangleShape2D_yhojp")
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="Area2D" to="." method="_on_area_2d_body_shape_entered"]
|
BIN
Objects/MovingPlatform/Sprite.kra
Normal file
BIN
Objects/MovingPlatform/Sprite.kra~
Normal file
BIN
Objects/MovingPlatform/Sprite.png
Normal file
After Width: | Height: | Size: 242 B |
34
Objects/MovingPlatform/Sprite.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bwj4inpj7mawo"
|
||||||
|
path="res://.godot/imported/Sprite.png-4d12e4f0bdc35ccba20a205fded1dede.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/MovingPlatform/Sprite.png"
|
||||||
|
dest_files=["res://.godot/imported/Sprite.png-4d12e4f0bdc35ccba20a205fded1dede.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
Objects/deltarune explosion greenscreen .mp4
Normal file
|
@ -9,6 +9,6 @@ func _ready():
|
||||||
await get_tree().create_timer(lifetime * 2).timeout
|
await get_tree().create_timer(lifetime * 2).timeout
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(_delta):
|
||||||
if following:
|
if following:
|
||||||
global_position = get_parent().global_position
|
global_position = get_parent().global_position
|
||||||
|
|
|
@ -9,7 +9,7 @@ func spin(veloc, delta):
|
||||||
var spinFactor = (veloc.x + vertSpinMult) / 40
|
var spinFactor = (veloc.x + vertSpinMult) / 40
|
||||||
spinFactor = clamp(spinFactor, -25, 25)
|
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)
|
rotation = lerp(rotation, rotation + (spinFactor), delta)
|
||||||
else:
|
else:
|
||||||
rotation = lerp(rotation, snappedf(rotation + clamp(spinFactor * delta * 2, -PI / 3, PI / 3), PI / 2), delta * 5)
|
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 not floored:
|
||||||
if player.is_on_ceiling() and landed < -100:
|
if player.is_on_ceiling() and landed < -100:
|
||||||
rotation = 0
|
rotation = 0
|
||||||
scale.y = 1 + (landed / 800)
|
scale.y = 1 + (landed / 800.)
|
||||||
scale.x = 1 - (landed / 800)
|
scale.x = 1 - (landed / 800.)
|
||||||
|
|
||||||
|
|
||||||
spin(velocity, delta)
|
spin(velocity, delta)
|
||||||
|
|
|
@ -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/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"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_67e7r"]
|
||||||
radius = 8.0
|
size = Vector2(16, 16)
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_mnfw7"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_mnfw7"]
|
||||||
radius = 4.0
|
radius = 4.0
|
||||||
|
@ -17,12 +23,30 @@ script = ExtResource("1_c5ycp")
|
||||||
savedInputsPath = "res://Player/Ghosts/GhostData/testGhostRecording.res"
|
savedInputsPath = "res://Player/Ghosts/GhostData/testGhostRecording.res"
|
||||||
|
|
||||||
[node name="CircleCollider" type="CollisionShape2D" parent="."]
|
[node name="CircleCollider" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_jbiem")
|
shape = SubResource("RectangleShape2D_67e7r")
|
||||||
|
|
||||||
[node name="SquishDetection" type="Area2D" parent="."]
|
[node name="SquishDetection" type="Area2D" parent="."]
|
||||||
|
|
||||||
[node name="CircleCollider" type="CollisionShape2D" parent="SquishDetection"]
|
[node name="CircleCollider" type="CollisionShape2D" parent="SquishDetection"]
|
||||||
shape = SubResource("CircleShape2D_mnfw7")
|
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_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"]
|
[connection signal="body_shape_exited" from="SquishDetection" to="." method="_on_squish_detection_body_shape_exited"]
|
||||||
|
|
|
@ -4,6 +4,7 @@ const SPEED = 500.0
|
||||||
const ACCEL = 7.0
|
const ACCEL = 7.0
|
||||||
var direction = 0
|
var direction = 0
|
||||||
var addedveloc = 0
|
var addedveloc = 0
|
||||||
|
var forcedVeloc = 0
|
||||||
|
|
||||||
const JUMP_VELOCITY = -450.0
|
const JUMP_VELOCITY = -450.0
|
||||||
const MAX_JUMPS = 1
|
const MAX_JUMPS = 1
|
||||||
|
@ -27,10 +28,11 @@ var startPos = Vector2.ZERO
|
||||||
|
|
||||||
var can_move = true
|
var can_move = true
|
||||||
|
|
||||||
@onready var camera = $Camera
|
var camera : Camera2D
|
||||||
|
|
||||||
@export var savedInputsPath : String
|
@export var savedInputsPath : String
|
||||||
var savedInputsRef = load(savedInputsPath)
|
|
||||||
|
@onready var sceneReload = load(get_tree().current_scene.scene_file_path)
|
||||||
|
|
||||||
var savedInputs = []
|
var savedInputs = []
|
||||||
|
|
||||||
|
@ -66,10 +68,21 @@ func getAxis(inp1, inp2):
|
||||||
return Input.get_axis(inp1, inp2)
|
return Input.get_axis(inp1, inp2)
|
||||||
|
|
||||||
func isWallSliding():
|
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
|
return is_on_wall_only() and direction
|
||||||
|
|
||||||
func getGravMulti():
|
func getGravMulti():
|
||||||
var axis = (gen.boolToNumb(actionPressed("up"), 1))
|
var axis = (gen.boolToNumb(actionPressed("up") or forceLowGrav, 1))
|
||||||
if velocity.y < 0:
|
if velocity.y < 0:
|
||||||
return axis
|
return axis
|
||||||
return 1
|
return 1
|
||||||
|
@ -78,11 +91,21 @@ func launch(veloc):
|
||||||
addedveloc = veloc
|
addedveloc = veloc
|
||||||
velocity.x = veloc
|
velocity.x = veloc
|
||||||
|
|
||||||
|
func forceLaunch(veloc):
|
||||||
|
forcedVeloc = veloc
|
||||||
|
velocity.x = veloc
|
||||||
|
|
||||||
signal Jumped
|
signal Jumped
|
||||||
signal Died
|
signal Died
|
||||||
|
|
||||||
var deathParticles = preload("res://Particles/Player/deathParticles.tscn")
|
var deathParticles = preload("res://Particles/Player/deathParticles.tscn")
|
||||||
|
|
||||||
|
var doubleWallJumped = false
|
||||||
|
|
||||||
|
var forceLowGrav = true
|
||||||
|
|
||||||
|
var landed = false
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
Died.emit()
|
Died.emit()
|
||||||
var parti = deathParticles.instantiate()
|
var parti = deathParticles.instantiate()
|
||||||
|
@ -90,26 +113,20 @@ func die():
|
||||||
add_child(parti)
|
add_child(parti)
|
||||||
can_move = false
|
can_move = false
|
||||||
$Sprite.visible = false
|
$Sprite.visible = false
|
||||||
var camTween = get_tree().create_tween()
|
|
||||||
camTween.set_trans(Tween.TRANS_SINE)
|
gen.savedPos = checkpointPos
|
||||||
camTween.set_ease(Tween.EASE_IN_OUT)
|
|
||||||
#camTween.tween_property(camera, "global_position", global_position, 1)
|
await Camera.deathAnim().finished
|
||||||
camTween.tween_property(camera, "global_position", checkpointPos, (global_position.distance_to(checkpointPos) / 2500) + 0.5).set_delay(1)
|
|
||||||
await camTween.finished
|
get_tree().change_scene_to_packed(sceneReload)
|
||||||
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():
|
func _ready():
|
||||||
startPos = global_position
|
RenderingServer.set_default_clear_color(Color8(0, 0, 0))
|
||||||
|
if find_child("Camera"):
|
||||||
|
camera = $Camera
|
||||||
|
|
||||||
if ghostMode:
|
if ghostMode:
|
||||||
|
startPos = global_position
|
||||||
var rc = load(savedInputsPath)
|
var rc = load(savedInputsPath)
|
||||||
|
|
||||||
if rc:
|
if rc:
|
||||||
|
@ -141,12 +158,27 @@ func _ready():
|
||||||
elif inputName in held:
|
elif inputName in held:
|
||||||
held.remove_at(held.find(inputName))
|
held.remove_at(held.find(inputName))
|
||||||
savedInputs[frame] += held
|
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"
|
@onready var trail = $"Sprite/Trail"
|
||||||
var ghosting = true
|
var ghosting = true
|
||||||
|
|
||||||
var ghostParti = preload("res://Particles/Ghosts/spawnParticles.tscn")
|
var ghostParti = preload("res://Particles/Ghosts/spawnParticles.tscn")
|
||||||
|
|
||||||
|
var lastFloor = null
|
||||||
|
|
||||||
func spawnParti():
|
func spawnParti():
|
||||||
var parti = ghostParti.instantiate()
|
var parti = ghostParti.instantiate()
|
||||||
add_child(parti)
|
add_child(parti)
|
||||||
|
@ -178,18 +210,38 @@ func _physics_process(delta):
|
||||||
|
|
||||||
wallKayote -= delta
|
wallKayote -= delta
|
||||||
|
|
||||||
|
if is_on_floor() and !landed:
|
||||||
|
velocity.y = 0
|
||||||
|
|
||||||
if not is_on_floor():
|
if not is_on_floor():
|
||||||
if velocity.y < 2000:
|
if velocity.y < 2000:
|
||||||
velocity.y += gravity * delta / getGravMulti()
|
velocity.y += gravity * delta / getGravMulti()
|
||||||
|
|
||||||
floorTime = 0
|
floorTime = 0
|
||||||
kayote -= delta
|
kayote -= delta
|
||||||
|
if lastFloor:
|
||||||
|
if "velocity" in lastFloor:
|
||||||
|
velocity += lastFloor.velocity
|
||||||
|
lastFloor = null
|
||||||
else:
|
else:
|
||||||
|
#velocity.y = 0
|
||||||
|
doubleWallJumped = false
|
||||||
kayote = 0.3
|
kayote = 0.3
|
||||||
floorTime += delta
|
floorTime += delta
|
||||||
jumps = MAX_JUMPS
|
jumps = MAX_JUMPS
|
||||||
falling = false
|
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():
|
if isWallSliding():
|
||||||
wallKayote = 0.3
|
wallKayote = 0.3
|
||||||
falling = false
|
falling = false
|
||||||
|
@ -199,25 +251,25 @@ func _physics_process(delta):
|
||||||
|
|
||||||
if actionJustPressed("jump"):
|
if actionJustPressed("jump"):
|
||||||
if wallKayote > 0 and not is_on_floor():
|
if wallKayote > 0 and not is_on_floor():
|
||||||
wallKayote /= 2
|
if doubleWallJumped:
|
||||||
|
wallKayote = 0
|
||||||
|
else:
|
||||||
|
doubleWallJumped = true
|
||||||
|
wallKayote += 0.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)
|
|
||||||
if result and "velocity" in result.collider:
|
|
||||||
velocity.y += result.collider.velocity.y
|
|
||||||
if actionPressed("down"):
|
if actionPressed("down"):
|
||||||
launch(get_wall_normal().x * SPEED * 1.75)
|
launch(get_wall_normal().x * SPEED * 1.75)
|
||||||
velocity.y = clamp((velocity.y / 2) + JUMP_VELOCITY / 1.8, -INF, JUMP_VELOCITY / 1.8)
|
velocity.y = clamp((velocity.y / 2) + JUMP_VELOCITY / 1.8, -INF, JUMP_VELOCITY / 1.8)
|
||||||
else:
|
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)
|
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()
|
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)
|
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
|
||||||
|
doubleWallJumped = false
|
||||||
if kayote < 0:
|
if kayote < 0:
|
||||||
jumps -= 1
|
jumps -= 1
|
||||||
else:
|
else:
|
||||||
|
@ -229,9 +281,10 @@ func _physics_process(delta):
|
||||||
velocity += result.collider.velocity
|
velocity += result.collider.velocity
|
||||||
|
|
||||||
falling = false
|
falling = false
|
||||||
if actionPressed("down") and not is_on_floor() and kayote > 0:
|
if actionPressed("down") and kayote > 0 and abs(velocity.x) < SPEED * 1.5:
|
||||||
launch(direction * SPEED * 1.75)
|
launch(direction * SPEED * 1.5)
|
||||||
kayote = 0
|
kayote = 0
|
||||||
|
Jumped.emit()
|
||||||
|
|
||||||
if actionJustPressed("down") and not falling and not isWallSliding():
|
if actionJustPressed("down") and not falling and not isWallSliding():
|
||||||
falling = true
|
falling = true
|
||||||
|
@ -244,7 +297,7 @@ func _physics_process(delta):
|
||||||
var query = PhysicsRayQueryParameters2D.create(global_position + (get_wall_normal() * 32), global_position + (get_wall_normal() * -64))
|
var query = PhysicsRayQueryParameters2D.create(global_position + (get_wall_normal() * 32), global_position + (get_wall_normal() * -64))
|
||||||
query.exclude = [self]
|
query.exclude = [self]
|
||||||
var result = space_state.intersect_ray(query)
|
var result = space_state.intersect_ray(query)
|
||||||
print(result)
|
|
||||||
if result and "velocity" in result.collider and abs(result.collider.velocity.x) > 50:
|
if result and "velocity" in result.collider and abs(result.collider.velocity.x) > 50:
|
||||||
velocity.y = lerpf(velocity.y, 0, delta * 30)
|
velocity.y = lerpf(velocity.y, 0, delta * 30)
|
||||||
else:
|
else:
|
||||||
|
@ -260,11 +313,20 @@ func _physics_process(delta):
|
||||||
addedveloc = lerp(addedveloc, velocity.x, ACCEL * 2 * delta)
|
addedveloc = lerp(addedveloc, velocity.x, ACCEL * 2 * delta)
|
||||||
velocity.x += addedveloc * delta * 15
|
velocity.x += addedveloc * delta * 15
|
||||||
|
|
||||||
addedveloc = lerpf(addedveloc, 0, delta * 5)
|
if abs(velocity.x) < abs(forcedVeloc):
|
||||||
|
forcedVeloc = lerp(forcedVeloc, velocity.x, ACCEL * 2 * delta)
|
||||||
|
velocity.x += forcedVeloc * delta * 35
|
||||||
|
|
||||||
|
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()
|
move_and_slide()
|
||||||
|
|
||||||
func _process(delta):
|
func _process(_delta):
|
||||||
if ghostMode:
|
if ghostMode:
|
||||||
if velocity.length() > 5:
|
if velocity.length() > 5:
|
||||||
trail.add_point(global_position)
|
trail.add_point(global_position)
|
||||||
|
@ -275,12 +337,11 @@ func _process(delta):
|
||||||
trail.remove_point(0)
|
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
|
squishers += 1
|
||||||
if squishers >= 2:
|
if squishers >= 2:
|
||||||
die()
|
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
|
squishers -= 1
|
||||||
print("Unsquish :(")
|
|
||||||
|
|
26
Player/BasicCharacter/SoundScript.gd
Normal 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()
|
21
Player/BasicCharacter/Sounds/Jump/jump.gd
Normal 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()
|
11
Player/BasicCharacter/Sounds/Jump/jump.tscn
Normal 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"]
|
BIN
Player/BasicCharacter/Sounds/Jump/jump.wav
Normal file
24
Player/BasicCharacter/Sounds/Jump/jump.wav.import
Normal 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
|
BIN
Player/BasicCharacter/Sounds/Landed.wav
Normal file
24
Player/BasicCharacter/Sounds/Landed.wav.import
Normal 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
|
BIN
Player/BasicCharacter/Sounds/SquishSound.wav
Normal file
24
Player/BasicCharacter/Sounds/SquishSound.wav.import
Normal 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
|
BIN
Player/BasicCharacter/Sounds/WallSlide/WallSlide.wav
Normal file
24
Player/BasicCharacter/Sounds/WallSlide/WallSlide.wav.import
Normal 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
|
11
Player/BasicCharacter/Sounds/WallSlide/WallslideSound.gd
Normal 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
|
|
@ -1,16 +1,51 @@
|
||||||
extends Camera2D
|
extends Camera2D
|
||||||
|
|
||||||
@onready var player = $"../"
|
var lastValid = false
|
||||||
|
var player = null
|
||||||
|
|
||||||
var speedMod = 0
|
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):
|
func _process(delta):
|
||||||
|
if is_instance_valid(player):
|
||||||
var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000)
|
var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000)
|
||||||
var direction = clamp(player.velocity.x, -1, 1)
|
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)
|
||||||
|
|
||||||
position = (get_local_mouse_position() / 2.5)
|
global_position = player.global_position
|
||||||
position.x += speedMod
|
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)
|
||||||
|
|
||||||
|
tween.tween_property(fader, "offset", Vector2(0, get_viewport().size.y), 0.3)
|
||||||
|
player = null
|
||||||
|
return tween
|
||||||
|
|
43
Player/Camera/camera.tscn
Normal 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
|
|
@ -15,7 +15,7 @@ var active = false
|
||||||
func track():
|
func track():
|
||||||
saved.append(gen.getCurrentActions())
|
saved.append(gen.getCurrentActions())
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(_delta):
|
||||||
if tracking:
|
if tracking:
|
||||||
track()
|
track()
|
||||||
|
|
||||||
|
|
|
@ -1,172 +1,8 @@
|
||||||
[gd_scene load_steps=9 format=3 uid="uid://c4x2fbs6bvxpp"]
|
[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"]
|
[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"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_jbiem"]
|
||||||
radius = 8.0
|
radius = 8.0
|
||||||
|
|
||||||
|
@ -207,7 +43,7 @@ scale_curve = SubResource("CurveTexture_ibtln")
|
||||||
collision_layer = 3
|
collision_layer = 3
|
||||||
floor_stop_on_slope = false
|
floor_stop_on_slope = false
|
||||||
floor_snap_length = 3.0
|
floor_snap_length = 3.0
|
||||||
script = SubResource("GDScript_nkjkv")
|
script = ExtResource("1_n3rkw")
|
||||||
|
|
||||||
[node name="BoxCollider" type="CollisionShape2D" parent="."]
|
[node name="BoxCollider" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("CircleShape2D_jbiem")
|
shape = SubResource("CircleShape2D_jbiem")
|
||||||
|
|
|
@ -76,7 +76,8 @@ func _physics_process(delta):
|
||||||
modulate = Color8(0, 255, 150)
|
modulate = Color8(0, 255, 150)
|
||||||
proj.modulate = modulate
|
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
|
#grappleDur = 10
|
||||||
add_child(proj)
|
add_child(proj)
|
||||||
|
|
||||||
|
|
BIN
Tilemaps/BasicSquare/CrackedSquare.kra
Normal file
BIN
Tilemaps/BasicSquare/CrackedSquare.kra~
Normal file
BIN
Tilemaps/BasicSquare/CrackedSquare.png
Normal file
After Width: | Height: | Size: 511 B |
34
Tilemaps/BasicSquare/CrackedSquare.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://b2qxnuvqe1kfh"
|
||||||
|
path="res://.godot/imported/CrackedSquare.png-1353265776c3b01c21757b6a1c2f7d64.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Tilemaps/BasicSquare/CrackedSquare.png"
|
||||||
|
dest_files=["res://.godot/imported/CrackedSquare.png-1353265776c3b01c21757b6a1c2f7d64.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
Tilemaps/BasicSquare/CrackedSquare.png~
Normal file
After Width: | Height: | Size: 496 B |
BIN
Tilemaps/BasicSquare/Square.kra~
Normal file
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
|
@ -3,15 +3,15 @@
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://dmlk63esqvmiv"
|
uid="uid://dmlk63esqvmiv"
|
||||||
path="res://.godot/imported/Texture.png-93165ce48330176d929ec76fdce1b48c.ctex"
|
path="res://.godot/imported/Square.png-0e4360a72f532de88599b631bd37b503.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://Tilemaps/BasicSquare/Texture.png"
|
source_file="res://Tilemaps/BasicSquare/Square.png"
|
||||||
dest_files=["res://.godot/imported/Texture.png-93165ce48330176d929ec76fdce1b48c.ctex"]
|
dest_files=["res://.godot/imported/Square.png-0e4360a72f532de88599b631bd37b503.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
BIN
Tilemaps/BasicSquare/Square.png~
Normal file
After Width: | Height: | Size: 155 B |
|
@ -11,14 +11,17 @@ config_version=5
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Grapple Test"
|
config/name="Grapple Test"
|
||||||
run/main_scene="res://Maps/MapTest2.tscn"
|
run/main_scene="res://Maps/Level1/Level1.tscn"
|
||||||
config/features=PackedStringArray("4.2", "Forward Plus")
|
config/features=PackedStringArray("4.2", "Forward Plus")
|
||||||
|
run/max_fps=60
|
||||||
boot_splash/bg_color=Color(0, 0, 0, 1)
|
boot_splash/bg_color=Color(0, 0, 0, 1)
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
gen="*res://Core/Scripts/GeneralFunctions.gd"
|
gen="*res://Core/Scripts/GeneralFunctions.gd"
|
||||||
|
Music="*res://Core/Scripts/music.gd"
|
||||||
|
Camera="*res://Player/Camera/camera.tscn"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
||||||
|
@ -28,6 +31,7 @@ settings/stdout/print_fps=true
|
||||||
|
|
||||||
window/size/viewport_width=1920
|
window/size/viewport_width=1920
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=1080
|
||||||
|
window/size/mode=3
|
||||||
|
|
||||||
[editor]
|
[editor]
|
||||||
|
|
||||||
|
@ -89,11 +93,9 @@ respawn={
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
common/physics_ticks_per_second=144
|
|
||||||
common/physics_jitter_fix=0.0
|
common/physics_jitter_fix=0.0
|
||||||
2d/default_gravity=1300.0
|
2d/default_gravity=1300.0
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
textures/canvas_textures/default_texture_filter=0
|
textures/canvas_textures/default_texture_filter=0
|
||||||
environment/defaults/default_clear_color=Color(0.0980392, 0.0980392, 0.0980392, 1)
|
|
||||||
|
|