Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
b5dc704017 | |||
d0d7899340 | |||
4f70414ed9 | |||
|
279b5e5599 | ||
|
421220e763 | ||
|
c290b1ce72 | ||
|
13ccecad19 | ||
|
5cfdd34e96 | ||
|
edc9eb5d73 | ||
|
4cffceb1f4 | ||
|
14ef7ad7f9 |
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
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
|
25
Core/Scripts/GeneralFunctions.gd
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var savedPos = Vector2.ZERO
|
||||||
|
|
||||||
|
func boolToNumb(val, offset=0):
|
||||||
|
return float(val) + offset
|
||||||
|
|
||||||
|
func getCurrentActions():
|
||||||
|
var actionsList = InputMap.get_actions()
|
||||||
|
var validActions = {}
|
||||||
|
for action in actionsList:
|
||||||
|
if not "ui_" in action:
|
||||||
|
if Input.is_action_just_pressed(action):
|
||||||
|
validActions[action] = 1
|
||||||
|
elif Input.is_action_just_released(action):
|
||||||
|
validActions[action] = 2
|
||||||
|
return validActions
|
||||||
|
|
||||||
|
func getRecordingFrameCount(recording):
|
||||||
|
var frameSort = []
|
||||||
|
for frame in recording:
|
||||||
|
frameSort.append(frame)
|
||||||
|
|
||||||
|
frameSort.sort()
|
||||||
|
return frameSort[-1]
|
4
Core/Scripts/music.gd
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
extends AudioStreamPlayer
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
play()
|
229
Core/Scripts/smoother.gd
Normal file
|
@ -0,0 +1,229 @@
|
||||||
|
# MIT LICENSE
|
||||||
|
#
|
||||||
|
# Copyright 2022 Anatol Bogun
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
# associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
# including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
|
# sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all copies or
|
||||||
|
# substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||||
|
# NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
|
class_name Smoother extends Node
|
||||||
|
|
||||||
|
## Smoother Node
|
||||||
|
## Version: 1.0.4
|
||||||
|
##
|
||||||
|
## A node type that smoothes scene nodes' properties by interpolating _physics_process steps.
|
||||||
|
##
|
||||||
|
## For documentation please visit https://github.com/anatolbogun/godot-smoother-node .
|
||||||
|
|
||||||
|
## Node properties that are interpolated.
|
||||||
|
## Defaults to ["position"], even if not displayed in the inspector.
|
||||||
|
@export var properties:Array[String] = ["position"]
|
||||||
|
|
||||||
|
## Apply interpolation to this node's parent.
|
||||||
|
@export var smooth_parent: = true :
|
||||||
|
set (value):
|
||||||
|
if value == false:
|
||||||
|
# remove parent from _properties in case this gets toggled on and off during runtime
|
||||||
|
_properties.erase(get_parent())
|
||||||
|
|
||||||
|
smooth_parent = value
|
||||||
|
|
||||||
|
## Apply interpolation to the recursive children of this node's parent.
|
||||||
|
@export var recursive: = true
|
||||||
|
|
||||||
|
## Explicitly include node paths in addition to the nodes that are included by other Smoother
|
||||||
|
## settings.
|
||||||
|
@export var includes:Array[NodePath] = []
|
||||||
|
|
||||||
|
## Explicitly exclude node paths.
|
||||||
|
## This will exclude nodes that would otherwise be included by other settings.
|
||||||
|
@export var excludes:Array[NodePath] = []
|
||||||
|
|
||||||
|
# get an array of all currently smoothed nodes; mainly for debugging performance optimisations
|
||||||
|
var smoothed_nodes:Array[Node] :
|
||||||
|
get:
|
||||||
|
var parent: = get_parent()
|
||||||
|
return _get_physics_process_nodes(parent, !smooth_parent) if parent != null else [] as Array[Node]
|
||||||
|
|
||||||
|
var _properties: = {}
|
||||||
|
var _physics_process_nodes:Array[Node]
|
||||||
|
var _physics_process_just_updated: = false
|
||||||
|
|
||||||
|
|
||||||
|
## Reset all smoothed nodes.
|
||||||
|
func reset() -> void:
|
||||||
|
_properties.clear()
|
||||||
|
|
||||||
|
|
||||||
|
## Reset a specific node. You may want to call this when a node gets teleported.
|
||||||
|
func reset_node(node:Node) -> void:
|
||||||
|
_properties.erase(node)
|
||||||
|
|
||||||
|
|
||||||
|
## Reset a specific Node by NodePath. You may want to call this when a Node gets teleported.
|
||||||
|
func reset_node_path(path:NodePath) -> void:
|
||||||
|
var node: = get_node_or_null(path)
|
||||||
|
|
||||||
|
if node != null:
|
||||||
|
reset_node(node)
|
||||||
|
|
||||||
|
|
||||||
|
## Add a Node to the includes Array[NodePath].
|
||||||
|
func add_include_node(node:Node) -> Array[NodePath]:
|
||||||
|
return add_include_path(get_path_to(node))
|
||||||
|
|
||||||
|
|
||||||
|
## Add a NodePath to the includes Array[NodePath].
|
||||||
|
func add_include_path(path:NodePath) -> Array[NodePath]:
|
||||||
|
return _add_unique_to_array(includes, path) as Array[NodePath]
|
||||||
|
|
||||||
|
|
||||||
|
## Remove a Node from the includes Array[NodePath].
|
||||||
|
func remove_include_node(node:Node) -> Array[NodePath]:
|
||||||
|
return remove_include_path(get_path_to(node))
|
||||||
|
|
||||||
|
|
||||||
|
## Remove a NodePath from the includes Array[NodePath].
|
||||||
|
func remove_include_path(path:NodePath) -> Array[NodePath]:
|
||||||
|
return _remove_all_from_array(includes, path) as Array[NodePath]
|
||||||
|
|
||||||
|
|
||||||
|
## Add a Node to the excludes Array[NodePath].
|
||||||
|
func add_exclude_node(node:Node) -> Array[NodePath]:
|
||||||
|
return add_exclude_path(get_path_to(node))
|
||||||
|
|
||||||
|
|
||||||
|
## Add a NodePath to the excludes Array[NodePath].
|
||||||
|
func add_exclude_path(path:NodePath) -> Array[NodePath]:
|
||||||
|
return _add_unique_to_array(excludes, path) as Array[NodePath]
|
||||||
|
|
||||||
|
|
||||||
|
## Remove a Node from the excludes Array[NodePath].
|
||||||
|
func remove_exclude_node(node:Node) -> Array[NodePath]:
|
||||||
|
return remove_exclude_path(get_path_to(node))
|
||||||
|
|
||||||
|
|
||||||
|
## Remove a NodePath from the excludes Array[NodePath].
|
||||||
|
func remove_exclude_path(path:NodePath) -> Array[NodePath]:
|
||||||
|
return _remove_all_from_array(excludes, path) as Array[NodePath]
|
||||||
|
|
||||||
|
|
||||||
|
## Add an item to an array unless the array already contains that item.
|
||||||
|
func _add_unique_to_array(array:Array, item:Variant) -> Array:
|
||||||
|
if !array.has(item):
|
||||||
|
array.push_back(item)
|
||||||
|
|
||||||
|
return array
|
||||||
|
|
||||||
|
|
||||||
|
## Remove all array items that match item.
|
||||||
|
func _remove_all_from_array(array:Array, item:Variant) -> Array:
|
||||||
|
while array.has(item):
|
||||||
|
array.erase(item)
|
||||||
|
|
||||||
|
return array
|
||||||
|
|
||||||
|
|
||||||
|
## Apply interpolation to all smoothed_nodes supported properties.
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
for node in _physics_process_nodes:
|
||||||
|
if !_properties.has(node): continue
|
||||||
|
|
||||||
|
for property in _properties[node]:
|
||||||
|
var values = _properties[node][property]
|
||||||
|
|
||||||
|
if values.size() == 2:
|
||||||
|
if _physics_process_just_updated:
|
||||||
|
values[1] = node[property]
|
||||||
|
|
||||||
|
node[property] = lerp(values[0], values[1], Engine.get_physics_interpolation_fraction())
|
||||||
|
|
||||||
|
_physics_process_just_updated = false
|
||||||
|
|
||||||
|
|
||||||
|
## Store all smoothed_nodes' relevant properties of the previous (origin) and this (target)
|
||||||
|
## _physics_process frames for interpolation in the upcoming _process frames and apply the origin
|
||||||
|
## values.
|
||||||
|
func _physics_process(_delta: float) -> void:
|
||||||
|
var parent: = get_parent()
|
||||||
|
if parent == null: return
|
||||||
|
|
||||||
|
# move this node to the top of the parent tree (typically a scene's root node) so that it is
|
||||||
|
# called before all other _physics_processes
|
||||||
|
parent.move_child(self, 0)
|
||||||
|
|
||||||
|
if smooth_parent:
|
||||||
|
process_priority = parent.process_priority - 1
|
||||||
|
|
||||||
|
# update the relevant nodes once per _physics_process
|
||||||
|
_physics_process_nodes = _get_physics_process_nodes(parent, !smooth_parent)
|
||||||
|
|
||||||
|
# clean up _properties
|
||||||
|
for key in _properties.keys():
|
||||||
|
if !_physics_process_nodes.has(key):
|
||||||
|
_properties.erase(key)
|
||||||
|
|
||||||
|
for node in _physics_process_nodes:
|
||||||
|
if !_properties.has(node):
|
||||||
|
# called on the first frame after a node was added to _properties
|
||||||
|
_properties[node] = {}
|
||||||
|
|
||||||
|
# clean up _properties when a node exited the tree
|
||||||
|
node.tree_exited.connect(func (): _properties.erase(node))
|
||||||
|
|
||||||
|
for property in properties:
|
||||||
|
if ! property in node: continue
|
||||||
|
|
||||||
|
if !_properties[node].has(property):
|
||||||
|
# called on the first frame after a node was added to _properties
|
||||||
|
_properties[node][property] = [node[property]]
|
||||||
|
elif _properties[node][property].size() < 2:
|
||||||
|
# called on the second frame after a node was added to _properties
|
||||||
|
_properties[node][property].push_front(_properties[node][property][0])
|
||||||
|
_properties[node][property][1] = node[property]
|
||||||
|
else:
|
||||||
|
_properties[node][property][0] = _properties[node][property][1]
|
||||||
|
node[property] = _properties[node][property][0]
|
||||||
|
|
||||||
|
_physics_process_just_updated = true
|
||||||
|
|
||||||
|
|
||||||
|
## Get the relevant nodes to be smoothed based on this node's tree position and properties.
|
||||||
|
func _get_physics_process_nodes(node: Node, ignore_node: = false, with_includes: = true) -> Array[Node]:
|
||||||
|
var nodes:Array[Node] = []
|
||||||
|
|
||||||
|
nodes.assign(includes.map(
|
||||||
|
get_node_or_null
|
||||||
|
).filter(
|
||||||
|
func (_node:Node) -> bool: return _node != null && !excludes.has(get_path_to(_node))
|
||||||
|
) if with_includes else [])
|
||||||
|
|
||||||
|
if (
|
||||||
|
!ignore_node
|
||||||
|
&& node != self
|
||||||
|
&& !node is RigidBody2D
|
||||||
|
&& !node is RigidBody3D
|
||||||
|
&& !nodes.has(node)
|
||||||
|
&& !excludes.has(get_path_to(node))
|
||||||
|
&& node.has_method("_physics_process")
|
||||||
|
):
|
||||||
|
nodes.push_back(node)
|
||||||
|
|
||||||
|
if recursive:
|
||||||
|
for child in node.get_children():
|
||||||
|
for nested_node in _get_physics_process_nodes(child, false, false):
|
||||||
|
_add_unique_to_array(nodes, nested_node)
|
||||||
|
|
||||||
|
return nodes
|
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
|
88
Maps/Testing Purgatory/Testing Purgatory.tscn
Normal file
12
Objects/AnimTrigger/AnimTrigger.gd
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
@export var animator : AnimationPlayer
|
||||||
|
@export var animation : String
|
||||||
|
@export var playOnce := true
|
||||||
|
|
||||||
|
var animReady = false
|
||||||
|
|
||||||
|
func _on_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
|
||||||
|
animator.play(animation)
|
||||||
|
if playOnce:
|
||||||
|
queue_free()
|
14
Objects/AnimTrigger/anim_trigger.tscn
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dc8odchuhx80d"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Objects/AnimTrigger/AnimTrigger.gd" id="1_n4pxa"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ilg2i"]
|
||||||
|
|
||||||
|
[node name="AnimTrigger" type="Area2D"]
|
||||||
|
collision_layer = 4
|
||||||
|
script = ExtResource("1_n4pxa")
|
||||||
|
|
||||||
|
[node name="Collider" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_ilg2i")
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="." to="." method="_on_body_shape_entered"]
|
6
Objects/Checkpoint/Checkpoint.gd
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
func _on_body_shape_entered(_body_rid, body, _body_shape_index, _local_shape_index):
|
||||||
|
if "checkpointPos" in body:
|
||||||
|
body.checkpointPos = body.global_position
|
||||||
|
queue_free()
|
13
Objects/Checkpoint/Checkpoint.tscn
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://dep314vkturtp"]
|
||||||
|
|
||||||
|
[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"]
|
13
Objects/DeathCollider/DeathCollider.gd
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
var killing = null
|
||||||
|
@export var detecting := false
|
||||||
|
|
||||||
|
func _on_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
||||||
|
if "die" in body and detecting:
|
||||||
|
killing = body
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
if killing:
|
||||||
|
killing.die()
|
||||||
|
killing = null
|
14
Objects/DeathCollider/DeathCollider.tscn
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://b5cr2rihwvwq2"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Objects/DeathCollider/DeathCollider.gd" id="1_get24"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pangl"]
|
||||||
|
size = Vector2(16, 16)
|
||||||
|
|
||||||
|
[node name="DeathCollider" type="Area2D"]
|
||||||
|
script = ExtResource("1_get24")
|
||||||
|
|
||||||
|
[node name="Collider" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_pangl")
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="." to="." method="_on_body_shape_entered"]
|
34
Objects/GroundSmasher/DualSmasher.gd
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var detecting = true
|
||||||
|
@export var once = false
|
||||||
|
|
||||||
|
func _on_anim_trigger_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
|
||||||
|
if detecting:
|
||||||
|
detecting = false
|
||||||
|
|
||||||
|
var tween = get_tree().create_tween()
|
||||||
|
tween.set_ease(Tween.EASE_IN)
|
||||||
|
tween.set_trans(Tween.TRANS_CUBIC)
|
||||||
|
tween.set_parallel(true)
|
||||||
|
|
||||||
|
tween.tween_property($SmasherBody, "position", Vector2(0, -66), 0.3)
|
||||||
|
tween.tween_property($SmasherBody2, "position", Vector2(0, 66), 0.3)
|
||||||
|
|
||||||
|
await tween.finished
|
||||||
|
|
||||||
|
if not once:
|
||||||
|
tween = get_tree().create_tween()
|
||||||
|
tween.set_ease(Tween.EASE_IN)
|
||||||
|
tween.set_trans(Tween.TRANS_SINE)
|
||||||
|
tween.set_parallel(true)
|
||||||
|
|
||||||
|
tween.tween_property($SmasherBody, "position", Vector2(0, -100), 2).set_delay(1)
|
||||||
|
tween.tween_property($SmasherBody2, "position", Vector2(0, 100), 2).set_delay(1)
|
||||||
|
|
||||||
|
await tween.finished
|
||||||
|
|
||||||
|
detecting = true
|
||||||
|
else:
|
||||||
|
$AnimTrigger.queue_free()
|
||||||
|
|
42
Objects/GroundSmasher/DualSmasher.tscn
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://cufm4g76fik7t"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dc8odchuhx80d" path="res://Objects/AnimTrigger/anim_trigger.tscn" id="1_cq28h"]
|
||||||
|
[ext_resource type="Script" path="res://Objects/GroundSmasher/DualSmasher.gd" id="1_px0wu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cnkms0met64fy" path="res://Objects/GroundSmasher/Smasher.png" id="2_6f7iw"]
|
||||||
|
|
||||||
|
[node name="Smasher" type="Node2D"]
|
||||||
|
z_index = -1
|
||||||
|
script = ExtResource("1_px0wu")
|
||||||
|
|
||||||
|
[node name="AnimTrigger" parent="." instance=ExtResource("1_cq28h")]
|
||||||
|
scale = Vector2(1.6, 4)
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 2
|
||||||
|
script = null
|
||||||
|
|
||||||
|
[node name="SmasherBody" type="AnimatableBody2D" parent="."]
|
||||||
|
position = Vector2(0, -100)
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="SmasherBody"]
|
||||||
|
position = Vector2(0, -37)
|
||||||
|
texture = ExtResource("2_6f7iw")
|
||||||
|
offset = Vector2(0, 40)
|
||||||
|
|
||||||
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SmasherBody"]
|
||||||
|
position = Vector2(0, -8)
|
||||||
|
polygon = PackedVector2Array(-16, -52, -16, 68, -13, 74, 0, 74, 13, 74, 16, 68, 16, -52)
|
||||||
|
|
||||||
|
[node name="SmasherBody2" type="AnimatableBody2D" parent="."]
|
||||||
|
position = Vector2(0, 100)
|
||||||
|
rotation = 3.14159
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="SmasherBody2"]
|
||||||
|
position = Vector2(0, -37)
|
||||||
|
texture = ExtResource("2_6f7iw")
|
||||||
|
offset = Vector2(0, 40)
|
||||||
|
|
||||||
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="SmasherBody2"]
|
||||||
|
position = Vector2(0, -8)
|
||||||
|
polygon = PackedVector2Array(-16, -52, -16, 68, -13, 74, 0, 74, 13, 74, 16, 68, 16, -52)
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="AnimTrigger" to="." method="_on_anim_trigger_body_shape_entered"]
|
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 |
BIN
Objects/GroundSmasher/Smasher.kra
Normal file
BIN
Objects/GroundSmasher/Smasher.kra~
Normal file
BIN
Objects/GroundSmasher/Smasher.png
Normal file
After Width: | Height: | Size: 235 B |
34
Objects/GroundSmasher/Smasher.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cnkms0met64fy"
|
||||||
|
path="res://.godot/imported/Smasher.png-f4cece1b9694499f701efe8bcdb2c27c.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Objects/GroundSmasher/Smasher.png"
|
||||||
|
dest_files=["res://.godot/imported/Smasher.png-f4cece1b9694499f701efe8bcdb2c27c.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/Smasher.png~
Normal file
After Width: | Height: | Size: 214 B |
82
Objects/GroundSmasher/SmasherCollide.gd
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
extends AnimatableBody2D
|
||||||
|
|
||||||
|
@onready var tip = $"Tip"
|
||||||
|
@onready var warnSign = $"../WarnSign"
|
||||||
|
@onready var warnBorder = $"../WarnBorder"
|
||||||
|
|
||||||
|
@export var once = false
|
||||||
|
|
||||||
|
var detecting = true
|
||||||
|
|
||||||
|
var velocity = Vector2.ZERO
|
||||||
|
|
||||||
|
@onready var startPos = global_position
|
||||||
|
|
||||||
|
func _on_anim_trigger_body_shape_entered(_body_rid, _body, _body_shape_index, _local_shape_index):
|
||||||
|
if detecting:
|
||||||
|
|
||||||
|
detecting = false
|
||||||
|
var tween = get_tree().create_tween()
|
||||||
|
var space_state = get_world_2d().direct_space_state
|
||||||
|
|
||||||
|
var query = PhysicsRayQueryParameters2D.create(tip.global_position, tip.global_position + Vector2(0, 500).rotated(global_rotation))
|
||||||
|
var result = space_state.intersect_ray(query)
|
||||||
|
|
||||||
|
var finalPos = Vector2(0, 400).rotated(global_rotation)
|
||||||
|
if result:
|
||||||
|
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_ease(Tween.EASE_IN)
|
||||||
|
|
||||||
|
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(warnSign, "modulate", Color8(255, 255, 255, 255), 0.3).set_ease(Tween.EASE_OUT)
|
||||||
|
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)
|
||||||
|
|
||||||
|
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.set_parallel(true)
|
||||||
|
tween.set_trans(Tween.TRANS_SINE)
|
||||||
|
tween.set_ease(Tween.EASE_IN)
|
||||||
|
|
||||||
|
tween.tween_property(warnSign, "modulate", Color8(255, 255, 255, 0), 0.6)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
#constant_linear_velocity = Vector2.ZERO
|
||||||
|
|
||||||
|
await tween.finished
|
||||||
|
|
||||||
|
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 |
52
Objects/GroundSmasher/smasher.tscn
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
[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="Script" path="res://Objects/GroundSmasher/SmasherCollide.gd" id="3_2qfts"]
|
||||||
|
[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="AnimTrigger" parent="." instance=ExtResource("1_qvh2l")]
|
||||||
|
scale = Vector2(1.6, 4)
|
||||||
|
collision_layer = 2
|
||||||
|
collision_mask = 2
|
||||||
|
script = null
|
||||||
|
|
||||||
|
[node name="WarnSign" type="Sprite2D" parent="."]
|
||||||
|
modulate = Color(1, 1, 1, 0)
|
||||||
|
show_behind_parent = true
|
||||||
|
scale = Vector2(0.5, 0.5)
|
||||||
|
texture = ExtResource("4_5psq0")
|
||||||
|
|
||||||
|
[node name="WarnBorder" type="Line2D" parent="."]
|
||||||
|
modulate = Color(1, 0, 0, 0)
|
||||||
|
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="Crusher" type="AnimatableBody2D" parent="."]
|
||||||
|
position = Vector2(0, -97)
|
||||||
|
script = ExtResource("3_2qfts")
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite2D" parent="Crusher"]
|
||||||
|
modulate = Color(0, 0, 1, 1)
|
||||||
|
texture = ExtResource("4_kj73c")
|
||||||
|
|
||||||
|
[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
|
19
Objects/SceneTeleporter/teleporter.tscn
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://xb5tl1a6bkkc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Objects/SceneTeleporter/teleportergd.gd" id="1_l8pvx"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_wwqub"]
|
||||||
|
|
||||||
|
[node name="Teleporter" type="Node2D"]
|
||||||
|
position = Vector2(-361, 264)
|
||||||
|
script = ExtResource("1_l8pvx")
|
||||||
|
scenePath = "res://Maps/MapTest2.tscn"
|
||||||
|
|
||||||
|
[node name="CollisionDetector" type="Area2D" parent="."]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 2
|
||||||
|
|
||||||
|
[node name="CollisionShape" type="CollisionShape2D" parent="CollisionDetector"]
|
||||||
|
shape = SubResource("CircleShape2D_wwqub")
|
||||||
|
|
||||||
|
[connection signal="body_shape_entered" from="CollisionDetector" to="." method="_on_collision_detector_body_shape_entered"]
|
9
Objects/SceneTeleporter/teleportergd.gd
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var scenePath := "res://"
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
ResourceLoader.load_threaded_request(scenePath)
|
||||||
|
|
||||||
|
func _on_collision_detector_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
|
||||||
|
get_tree().change_scene_to_file(scenePath)
|
BIN
Objects/deltarune explosion greenscreen .mp4
Normal file
47
Particles/Ghosts/spawnParticles.tscn
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
[gd_scene load_steps=7 format=3 uid="uid://cuk6upumkoafl"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Particles/Scripts/OneshotParticles.gd" id="1_001fc"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_nt6ns"]
|
||||||
|
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_82f2f"]
|
||||||
|
curve = SubResource("Curve_nt6ns")
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_d0nr1"]
|
||||||
|
_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_p73qn"]
|
||||||
|
curve = SubResource("Curve_d0nr1")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_0xiht"]
|
||||||
|
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_82f2f")
|
||||||
|
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_p73qn")
|
||||||
|
|
||||||
|
[node name="SpawnParticles" type="GPUParticles2D"]
|
||||||
|
modulate = Color(0, 1, 1, 1)
|
||||||
|
amount = 20
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_0xiht")
|
||||||
|
lifetime = 2.0
|
||||||
|
speed_scale = 1.5
|
||||||
|
explosiveness = 1.0
|
||||||
|
fixed_fps = 0
|
||||||
|
interpolate = false
|
||||||
|
script = ExtResource("1_001fc")
|
41
Particles/Grapple/GrappleParti.tscn
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
[gd_scene load_steps=7 format=3 uid="uid://c7ee2fxogdnlx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Particles/Scripts/OneshotParticles.gd" id="1_8sxdw"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_ij5tg"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.721154, 0), -1.52381, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_lhu0n"]
|
||||||
|
curve = SubResource("Curve_ij5tg")
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_a1gx6"]
|
||||||
|
max_value = 3.0
|
||||||
|
_data = [Vector2(0, 3), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_210cn"]
|
||||||
|
curve = SubResource("Curve_a1gx6")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_75uqe"]
|
||||||
|
particle_flag_align_y = true
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
inherit_velocity_ratio = 0.5
|
||||||
|
initial_velocity_min = 250.0
|
||||||
|
initial_velocity_max = 250.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
damping_min = 50.0
|
||||||
|
damping_max = 50.0
|
||||||
|
scale_min = 0.5
|
||||||
|
scale_curve = SubResource("CurveTexture_lhu0n")
|
||||||
|
scale_over_velocity_max = 1000.0
|
||||||
|
scale_over_velocity_curve = SubResource("CurveTexture_210cn")
|
||||||
|
|
||||||
|
[node name="FireParticles" type="GPUParticles2D"]
|
||||||
|
top_level = true
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_75uqe")
|
||||||
|
lifetime = 0.75
|
||||||
|
explosiveness = 1.0
|
||||||
|
trail_enabled = true
|
||||||
|
trail_lifetime = 0.1
|
||||||
|
script = ExtResource("1_8sxdw")
|
11
Particles/Player/AfterImage.tscn
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bfd5g1y0u4e38"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Particles/Scripts/FadeAway.gd" id="1_jmv86"]
|
||||||
|
|
||||||
|
[node name="AfterImage" type="Sprite2D"]
|
||||||
|
modulate = Color(1, 1, 1, 0.752941)
|
||||||
|
show_behind_parent = true
|
||||||
|
top_level = true
|
||||||
|
visibility_layer = 257
|
||||||
|
rotation = 0.0123838
|
||||||
|
script = ExtResource("1_jmv86")
|
32
Particles/Player/deathParticles.tscn
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://b4u5ekdtnki35"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Particles/Scripts/OneshotParticles.gd" id="1_0mqow"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_68wdg"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -1.29471, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_sjct8"]
|
||||||
|
curve = SubResource("Curve_68wdg")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_gtww1"]
|
||||||
|
particle_flag_align_y = true
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
direction = Vector3(0, 1, 0)
|
||||||
|
spread = 180.0
|
||||||
|
flatness = 0.1
|
||||||
|
initial_velocity_min = 100.0
|
||||||
|
initial_velocity_max = 500.0
|
||||||
|
damping_min = 100.0
|
||||||
|
damping_max = 100.0
|
||||||
|
scale_min = 2.0
|
||||||
|
scale_max = 5.0
|
||||||
|
scale_curve = SubResource("CurveTexture_sjct8")
|
||||||
|
scale_over_velocity_min = 1.0
|
||||||
|
scale_over_velocity_max = 5.0
|
||||||
|
|
||||||
|
[node name="DeathParticles" type="GPUParticles2D"]
|
||||||
|
amount = 50
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_gtww1")
|
||||||
|
explosiveness = 1.0
|
||||||
|
script = ExtResource("1_0mqow")
|
20
Particles/Scripts/FadeAway.gd
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
extends Sprite2D
|
||||||
|
|
||||||
|
@onready var parent = get_parent()
|
||||||
|
|
||||||
|
var duration = 0.25
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self_modulate = parent.self_modulate
|
||||||
|
texture = parent.texture
|
||||||
|
scale = parent.scale
|
||||||
|
offset = parent.offset
|
||||||
|
global_position = parent.global_position
|
||||||
|
rotation = parent.rotation
|
||||||
|
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.tween_property(self, "modulate", Color8(255, 255, 255, 0), duration)
|
||||||
|
|
||||||
|
await get_tree().create_timer(duration).timeout
|
||||||
|
|
||||||
|
queue_free()
|
14
Particles/Scripts/OneshotParticles.gd
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
extends GPUParticles2D
|
||||||
|
|
||||||
|
var following = false
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
emitting = true
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
|
await get_tree().create_timer(lifetime * 2).timeout
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
if following:
|
||||||
|
global_position = get_parent().global_position
|
119
Player/BasicCharacter/AnimationController.gd
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
extends Sprite2D
|
||||||
|
|
||||||
|
@onready var player = $"../"
|
||||||
|
|
||||||
|
var spinAccel = 0
|
||||||
|
|
||||||
|
func spin(veloc, delta):
|
||||||
|
var vertSpinMult = abs(veloc.y) * clamp(veloc.x, -1, 1) / 1.5
|
||||||
|
var spinFactor = (veloc.x + vertSpinMult) / 40
|
||||||
|
spinFactor = clamp(spinFactor, -25, 25)
|
||||||
|
|
||||||
|
if (player.direction or abs(player.velocity.x) > 100) and not player.is_on_wall():
|
||||||
|
rotation = lerp(rotation, rotation + (spinFactor), delta)
|
||||||
|
else:
|
||||||
|
rotation = lerp(rotation, snappedf(rotation + clamp(spinFactor * delta * 2, -PI / 3, PI / 3), PI / 2), delta * 5)
|
||||||
|
|
||||||
|
var landed = 0
|
||||||
|
|
||||||
|
@onready var slidingVariants = [$"WallslidingNeutral", $"WallslidingUp", $"WallslidingDown"]
|
||||||
|
|
||||||
|
var afterImage = preload("res://Particles/Player/AfterImage.tscn")
|
||||||
|
|
||||||
|
func disableSlidingVariants(keep=null):
|
||||||
|
for variant in slidingVariants:
|
||||||
|
if variant != keep:
|
||||||
|
variant.emitting = false
|
||||||
|
|
||||||
|
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 floored = player.is_on_floor()
|
||||||
|
|
||||||
|
if velocity.length() >= 1100:
|
||||||
|
imaging = true
|
||||||
|
elif velocity.length() < 800:
|
||||||
|
imaging = false
|
||||||
|
|
||||||
|
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
|
||||||
|
lastImage = global_position
|
||||||
|
if player.isWallSliding():
|
||||||
|
var wallSlidingParticles = slidingVariants[0]
|
||||||
|
if abs(velocity.y) < 150:
|
||||||
|
wallSlidingParticles = slidingVariants[1]
|
||||||
|
elif abs(velocity.y) > 300:
|
||||||
|
wallSlidingParticles = slidingVariants[2]
|
||||||
|
|
||||||
|
disableSlidingVariants(wallSlidingParticles)
|
||||||
|
wallSlidingParticles.emitting = true
|
||||||
|
wallSlidingParticles.global_position = player.position + (player.get_wall_normal() * -8 * player.scale.x)
|
||||||
|
wallSlidingParticles.global_rotation = player.get_wall_normal().x * deg_to_rad(45)
|
||||||
|
|
||||||
|
else:
|
||||||
|
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
|
||||||
|
|
||||||
|
#scale = Vector2.ONE
|
||||||
|
|
||||||
|
if player.isWallSliding():
|
||||||
|
rotation = lerp(rotation, deg_to_rad(30) * player.get_wall_normal().x + snappedf(rotation, PI / 2), delta * 15)
|
||||||
|
else:
|
||||||
|
if Input.is_action_just_pressed("down"):
|
||||||
|
scale.x = 2
|
||||||
|
scale.y *= 0.5
|
||||||
|
|
||||||
|
var floorRot = player.get_floor_normal().angle() + (PI / 2)
|
||||||
|
|
||||||
|
if abs(rotation - floorRot) > 0.9:
|
||||||
|
rotation = floorRot
|
||||||
|
|
||||||
|
rotation = lerp(rotation, floorRot, delta * 10)
|
||||||
|
|
||||||
|
if landed:
|
||||||
|
rotation = 0
|
||||||
|
scale.y = 1 - (landed / 800)
|
||||||
|
scale.x = 1 + (landed / 800)
|
||||||
|
landed = 0
|
||||||
|
|
||||||
|
scale.y = lerp(scale.y, 1.0, delta * 7)
|
||||||
|
scale.x = lerp(scale.x, 1.0, delta * 7)
|
||||||
|
|
||||||
|
scale.y = clamp(scale.y, 0.25, INF)
|
||||||
|
scale.x = clamp(scale.x, 0.1, INF)
|
||||||
|
|
||||||
|
#modulate.h = abs(player.position.x / 400.)
|
||||||
|
offset.y = (8 * pow(scale.y, -1) - 8)
|
||||||
|
offset.x = 0
|
||||||
|
|
||||||
|
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
|
52
Player/BasicCharacter/Character.tscn
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
[gd_scene load_steps=10 format=3 uid="uid://cqcjan67wgkc1"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Player/BasicCharacter/CharacterController.gd" id="1_c5ycp"]
|
||||||
|
[ext_resource type="Script" path="res://Player/BasicCharacter/SoundScript.gd" id="3_ursor"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://d1rabaeyx578u" path="res://Player/BasicCharacter/Sounds/WallSlide/WallSlide.wav" id="4_s3e0l"]
|
||||||
|
[ext_resource type="Script" path="res://Player/BasicCharacter/Sounds/WallSlide/WallslideSound.gd" id="5_rp7we"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://d2hkg80n611cw" path="res://Player/BasicCharacter/Sounds/Landed.wav" id="6_7h6ch"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://ditim46yxen6i" path="res://Player/BasicCharacter/Sounds/SquishSound.wav" id="7_mp1ed"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bl4g0ao3b8b6p" path="res://Player/BasicCharacter/sprite.tscn" id="8_pl8jo"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_67e7r"]
|
||||||
|
size = Vector2(16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_mnfw7"]
|
||||||
|
radius = 4.0
|
||||||
|
|
||||||
|
[node name="Character" type="CharacterBody2D"]
|
||||||
|
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="CircleCollider" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_67e7r")
|
||||||
|
|
||||||
|
[node name="SquishDetection" type="Area2D" parent="."]
|
||||||
|
|
||||||
|
[node name="CircleCollider" type="CollisionShape2D" parent="SquishDetection"]
|
||||||
|
shape = SubResource("CircleShape2D_mnfw7")
|
||||||
|
|
||||||
|
[node name="Sounds" type="Node2D" parent="."]
|
||||||
|
script = ExtResource("3_ursor")
|
||||||
|
|
||||||
|
[node name="WallslideSound" type="AudioStreamPlayer2D" parent="Sounds"]
|
||||||
|
stream = ExtResource("4_s3e0l")
|
||||||
|
volume_db = -10.0
|
||||||
|
script = ExtResource("5_rp7we")
|
||||||
|
|
||||||
|
[node name="Landing" type="AudioStreamPlayer2D" parent="Sounds"]
|
||||||
|
stream = ExtResource("6_7h6ch")
|
||||||
|
|
||||||
|
[node name="Squish" type="AudioStreamPlayer2D" parent="Sounds"]
|
||||||
|
stream = ExtResource("7_mp1ed")
|
||||||
|
|
||||||
|
[node name="Sprite" parent="." instance=ExtResource("8_pl8jo")]
|
||||||
|
self_modulate = Color(1, 0, 0, 1)
|
||||||
|
|
||||||
|
[connection signal="Jumped" from="." to="Sounds" method="_on_character_jumped"]
|
||||||
|
[connection signal="body_shape_entered" from="SquishDetection" to="." method="_on_squish_detection_body_shape_entered"]
|
||||||
|
[connection signal="body_shape_exited" from="SquishDetection" to="." method="_on_squish_detection_body_shape_exited"]
|
347
Player/BasicCharacter/CharacterController.gd
Normal file
|
@ -0,0 +1,347 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
const SPEED = 500.0
|
||||||
|
const ACCEL = 7.0
|
||||||
|
var direction = 0
|
||||||
|
var addedveloc = 0
|
||||||
|
var forcedVeloc = 0
|
||||||
|
|
||||||
|
const JUMP_VELOCITY = -450.0
|
||||||
|
const MAX_JUMPS = 1
|
||||||
|
var jumps = MAX_JUMPS
|
||||||
|
|
||||||
|
var wallKayote = 0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
var camera : Camera2D
|
||||||
|
|
||||||
|
@export var savedInputsPath : String
|
||||||
|
|
||||||
|
@onready var sceneReload = load(get_tree().current_scene.scene_file_path)
|
||||||
|
|
||||||
|
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():
|
||||||
|
for collisionNumb in get_slide_collision_count():
|
||||||
|
var collision = get_slide_collision(collisionNumb)
|
||||||
|
var object = collision.get_collider()
|
||||||
|
|
||||||
|
if object is TileMap:
|
||||||
|
var tileMap : TileMap = object
|
||||||
|
var tilePos = tileMap.get_coords_for_body_rid(collision.get_collider_rid())
|
||||||
|
var tileData = tileMap.get_cell_tile_data(0, tilePos)
|
||||||
|
|
||||||
|
if tileData and not tileData.get_custom_data("Slidable") == true:
|
||||||
|
return false
|
||||||
|
return is_on_wall_only() and direction
|
||||||
|
|
||||||
|
func getGravMulti():
|
||||||
|
var axis = (gen.boolToNumb(actionPressed("up") or forceLowGrav, 1))
|
||||||
|
if velocity.y < 0:
|
||||||
|
return axis
|
||||||
|
return 1
|
||||||
|
|
||||||
|
func launch(veloc):
|
||||||
|
addedveloc = veloc
|
||||||
|
velocity.x = veloc
|
||||||
|
|
||||||
|
func forceLaunch(veloc):
|
||||||
|
forcedVeloc = veloc
|
||||||
|
velocity.x = veloc
|
||||||
|
|
||||||
|
signal Jumped
|
||||||
|
signal Died
|
||||||
|
|
||||||
|
var deathParticles = preload("res://Particles/Player/deathParticles.tscn")
|
||||||
|
|
||||||
|
var doubleWallJumped = false
|
||||||
|
|
||||||
|
var forceLowGrav = true
|
||||||
|
|
||||||
|
var landed = false
|
||||||
|
|
||||||
|
func die():
|
||||||
|
Died.emit()
|
||||||
|
var parti = deathParticles.instantiate()
|
||||||
|
parti.modulate = $Sprite.self_modulate
|
||||||
|
add_child(parti)
|
||||||
|
can_move = false
|
||||||
|
$Sprite.visible = false
|
||||||
|
|
||||||
|
gen.savedPos = checkpointPos
|
||||||
|
|
||||||
|
await Camera.deathAnim().finished
|
||||||
|
|
||||||
|
get_tree().change_scene_to_packed(sceneReload)
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
RenderingServer.set_default_clear_color(Color8(0, 0, 0))
|
||||||
|
if find_child("Camera"):
|
||||||
|
camera = $Camera
|
||||||
|
|
||||||
|
if ghostMode:
|
||||||
|
startPos = global_position
|
||||||
|
var rc = load(savedInputsPath)
|
||||||
|
|
||||||
|
if rc:
|
||||||
|
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
|
||||||
|
else:
|
||||||
|
Camera.player = self
|
||||||
|
var parti = deathParticles.instantiate()
|
||||||
|
parti.modulate = $Sprite.self_modulate
|
||||||
|
add_child(parti)
|
||||||
|
$Sprite.visible = true
|
||||||
|
$"../Smoother".reset_node(self)
|
||||||
|
#camera.position_smoothing_enabled = true
|
||||||
|
if gen.savedPos != Vector2.ZERO:
|
||||||
|
global_position = gen.savedPos
|
||||||
|
gen.savedPos = Vector2.ZERO
|
||||||
|
velocity = Vector2(0, 0)
|
||||||
|
#camera.reset_smoothing()
|
||||||
|
|
||||||
|
@onready var trail = $"Sprite/Trail"
|
||||||
|
var ghosting = true
|
||||||
|
|
||||||
|
var ghostParti = preload("res://Particles/Ghosts/spawnParticles.tscn")
|
||||||
|
|
||||||
|
var lastFloor = null
|
||||||
|
|
||||||
|
func spawnParti():
|
||||||
|
var parti = ghostParti.instantiate()
|
||||||
|
add_child(parti)
|
||||||
|
parti.top_level = true
|
||||||
|
parti.global_position = global_position
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
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 (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 is_on_floor() and !landed:
|
||||||
|
velocity.y = 0
|
||||||
|
|
||||||
|
if not is_on_floor():
|
||||||
|
if velocity.y < 2000:
|
||||||
|
velocity.y += gravity * delta / getGravMulti()
|
||||||
|
|
||||||
|
floorTime = 0
|
||||||
|
kayote -= delta
|
||||||
|
if lastFloor:
|
||||||
|
if "velocity" in lastFloor:
|
||||||
|
velocity += lastFloor.velocity
|
||||||
|
lastFloor = null
|
||||||
|
else:
|
||||||
|
#velocity.y = 0
|
||||||
|
doubleWallJumped = false
|
||||||
|
kayote = 0.3
|
||||||
|
floorTime += delta
|
||||||
|
jumps = MAX_JUMPS
|
||||||
|
falling = false
|
||||||
|
|
||||||
|
|
||||||
|
for collisionNumb in get_slide_collision_count():
|
||||||
|
var collision = get_slide_collision(collisionNumb)
|
||||||
|
var object = collision.get_collider()
|
||||||
|
|
||||||
|
if abs(collision.get_angle()) <= floor_max_angle:
|
||||||
|
lastFloor = object
|
||||||
|
|
||||||
|
if velocity.y <= 0:
|
||||||
|
forceLowGrav = false
|
||||||
|
|
||||||
|
if isWallSliding():
|
||||||
|
wallKayote = 0.3
|
||||||
|
falling = false
|
||||||
|
|
||||||
|
if actionJustPressed("respawn") or position.y > 5000:
|
||||||
|
die()
|
||||||
|
|
||||||
|
if actionJustPressed("jump"):
|
||||||
|
if wallKayote > 0 and not is_on_floor():
|
||||||
|
if doubleWallJumped:
|
||||||
|
wallKayote = 0
|
||||||
|
else:
|
||||||
|
doubleWallJumped = true
|
||||||
|
wallKayote += 0.1
|
||||||
|
|
||||||
|
if actionPressed("down"):
|
||||||
|
launch(get_wall_normal().x * SPEED * 1.75)
|
||||||
|
velocity.y = clamp((velocity.y / 2) + JUMP_VELOCITY / 1.8, -INF, JUMP_VELOCITY / 1.8)
|
||||||
|
else:
|
||||||
|
launch(get_wall_normal().x * SPEED * 1.4)
|
||||||
|
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
|
||||||
|
Jumped.emit()
|
||||||
|
|
||||||
|
#if result and "velocity" in result.collider:
|
||||||
|
#velocity.x += result.collider.velocity.x
|
||||||
|
elif jumps > 0:
|
||||||
|
velocity.y = clamp(velocity.y + JUMP_VELOCITY, -INF, JUMP_VELOCITY)
|
||||||
|
doubleWallJumped = false
|
||||||
|
if kayote < 0:
|
||||||
|
jumps -= 1
|
||||||
|
else:
|
||||||
|
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 kayote > 0 and abs(velocity.x) < SPEED * 1.5:
|
||||||
|
launch(direction * SPEED * 1.5)
|
||||||
|
kayote = 0
|
||||||
|
Jumped.emit()
|
||||||
|
|
||||||
|
if actionJustPressed("down") and not falling and not isWallSliding():
|
||||||
|
falling = true
|
||||||
|
velocity.y = clamp(velocity.y + FALL_SPEED, FALL_SPEED, INF)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
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
|
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
|
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
|
51
Player/Camera/CameraController.gd
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
extends Camera2D
|
||||||
|
|
||||||
|
var lastValid = false
|
||||||
|
var player = null
|
||||||
|
|
||||||
|
var speedMod = 0
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
get_tree().get_root().size_changed.connect(resize)
|
||||||
|
|
||||||
|
func resetZoom():
|
||||||
|
return Vector2.ONE * 3 * get_viewport().size.length() / 3000
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if is_instance_valid(player):
|
||||||
|
var velocModifier = clamp(abs(player.velocity.x) - 700, 0, 1000)
|
||||||
|
var direction = clamp(player.velocity.x, -1, 1)
|
||||||
|
|
||||||
|
speedMod = lerpf(speedMod, velocModifier * direction / 5, delta * 10)
|
||||||
|
|
||||||
|
global_position = (get_local_mouse_position() / 2.5) + player.global_position
|
||||||
|
global_position.x += speedMod
|
||||||
|
else:
|
||||||
|
lastValid = false
|
||||||
|
if player and not lastValid:
|
||||||
|
lastValid = true
|
||||||
|
var fader = $CanvasLayer/Fader
|
||||||
|
$CanvasLayer.visible = true
|
||||||
|
fader.offset = Vector2(0, get_viewport().size.y)
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.set_ease(Tween.EASE_IN).set_trans(Tween.TRANS_SINE)
|
||||||
|
tween.tween_property(fader, "offset", Vector2(0, get_viewport().size.y * 2), 0.5).set_delay(0.15)
|
||||||
|
|
||||||
|
global_position = player.global_position
|
||||||
|
zoom = resetZoom()
|
||||||
|
reset_smoothing()
|
||||||
|
|
||||||
|
await tween.finished
|
||||||
|
fader.offset = Vector2.ZERO
|
||||||
|
|
||||||
|
func resize():
|
||||||
|
zoom = resetZoom()
|
||||||
|
|
||||||
|
func deathAnim():
|
||||||
|
var fader = $CanvasLayer/Fader
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.set_ease(Tween.EASE_OUT).set_trans(Tween.TRANS_CUBIC)
|
||||||
|
|
||||||
|
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
|
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()
|
66
Player/GUI/GUI.tscn
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://b6rvghqqnqqk1"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Player/GUI/GuiRoot.gd" id="1_hovww"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_nvd2b"]
|
||||||
|
font_size = 32
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer"]
|
||||||
|
|
||||||
|
[node name="GuiRoot" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
script = ExtResource("1_hovww")
|
||||||
|
|
||||||
|
[node name="Velocity" type="Label" parent="GuiRoot"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_right = 79.0
|
||||||
|
offset_bottom = 23.0
|
||||||
|
text = "Velocity: 0"
|
||||||
|
label_settings = SubResource("LabelSettings_nvd2b")
|
||||||
|
|
||||||
|
[node name="HorzVeloc" type="Label" parent="GuiRoot"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_top = 44.0
|
||||||
|
offset_right = 328.0
|
||||||
|
offset_bottom = 89.0
|
||||||
|
text = "Horizontal Velocity: 0"
|
||||||
|
label_settings = SubResource("LabelSettings_nvd2b")
|
||||||
|
|
||||||
|
[node name="VertVeloc" type="Label" parent="GuiRoot"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_top = 88.0
|
||||||
|
offset_right = 283.0
|
||||||
|
offset_bottom = 133.0
|
||||||
|
text = "Vertical Velocity: 0"
|
||||||
|
label_settings = SubResource("LabelSettings_nvd2b")
|
||||||
|
|
||||||
|
[node name="AddedVeloc" type="Label" parent="GuiRoot"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_top = 132.0
|
||||||
|
offset_right = 283.0
|
||||||
|
offset_bottom = 177.0
|
||||||
|
text = "Added Velocity: 0"
|
||||||
|
label_settings = SubResource("LabelSettings_nvd2b")
|
||||||
|
|
||||||
|
[node name="Jumps" type="Label" parent="GuiRoot"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_top = 168.0
|
||||||
|
offset_right = 283.0
|
||||||
|
offset_bottom = 213.0
|
||||||
|
text = "Jumps: 0"
|
||||||
|
label_settings = SubResource("LabelSettings_nvd2b")
|
||||||
|
|
||||||
|
[node name="Grapples" type="Label" parent="GuiRoot"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_top = 208.0
|
||||||
|
offset_right = 283.0
|
||||||
|
offset_bottom = 253.0
|
||||||
|
text = "Grapples: 0"
|
||||||
|
label_settings = SubResource("LabelSettings_nvd2b")
|
5
Player/GUI/GuiController.gd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
extends Control
|
||||||
|
#
|
||||||
|
#func _process(delta):
|
||||||
|
#position = -get_viewport_transform().get_origin()
|
||||||
|
#print(position)
|
21
Player/GUI/GuiRoot.gd
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
@onready var player = $"../../"
|
||||||
|
|
||||||
|
@onready var velocNumb = $"Velocity"
|
||||||
|
@onready var horzVeloc = $"HorzVeloc"
|
||||||
|
@onready var vertVeloc = $"VertVeloc"
|
||||||
|
@onready var addedVeloc = $"AddedVeloc"
|
||||||
|
@onready var jumps = $"Jumps"
|
||||||
|
@onready var grapples = $"Grapples"
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
velocNumb.text = "Velocity: " + str(round(player.velocity.length()))
|
||||||
|
horzVeloc.text = "Horizontal Velocity: " + str(round(player.velocity.x))
|
||||||
|
vertVeloc.text = "Vertical Velocity: " + str(round(player.velocity.y))
|
||||||
|
addedVeloc.text = "Added Velocity: " + str(round(abs(player.addedveloc)))
|
||||||
|
jumps.text = "Jumps: " + str(player.jumps)
|
||||||
|
if player.find_child("Grapple"):
|
||||||
|
grapples.text = "Grapples: " + str(player.find_child("Grapple").grapples)
|
||||||
|
func _process(delta):
|
||||||
|
size = get_viewport().size
|
64
Player/Ghosts/CharacterGhost.tscn
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
[gd_scene load_steps=9 format=3 uid="uid://c4x2fbs6bvxpp"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Player/BasicCharacter/CharacterController.gd" id="1_n3rkw"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bl4g0ao3b8b6p" path="res://Player/BasicCharacter/sprite.tscn" id="2_mjdr3"]
|
||||||
|
|
||||||
|
[sub_resource type="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 = ExtResource("1_n3rkw")
|
||||||
|
|
||||||
|
[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/Level1JumpTutorial.res
Normal file
BIN
Player/Ghosts/GhostData/Level1WallJumpTutorial.res
Normal file
BIN
Player/Ghosts/GhostData/Level1WallJumpTutorial2.res
Normal file
BIN
Player/GrappleHook/GrappleCenter.png
Normal file
After Width: | Height: | Size: 121 B |
34
Player/GrappleHook/GrappleCenter.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bi5ofgcvid5qk"
|
||||||
|
path="res://.godot/imported/GrappleCenter.png-5e9ed5c2d1472f72fd1015c922d13ef9.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Player/GrappleHook/GrappleCenter.png"
|
||||||
|
dest_files=["res://.godot/imported/GrappleCenter.png-5e9ed5c2d1472f72fd1015c922d13ef9.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
|
123
Player/GrappleHook/GrappleHook.gd
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@onready var player = $"../../"
|
||||||
|
@onready var sprite = $"../"
|
||||||
|
|
||||||
|
@onready var grappleCore = $"GrappleCore"
|
||||||
|
|
||||||
|
var grappleProjectile = preload("res://Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.tscn")
|
||||||
|
|
||||||
|
var proj = null
|
||||||
|
var retractingProj = []
|
||||||
|
|
||||||
|
var grappleSpeed = Vector2.ZERO
|
||||||
|
var retractDur = 0
|
||||||
|
var retractStart = Vector2.ZERO
|
||||||
|
|
||||||
|
var grappleDur = 0
|
||||||
|
|
||||||
|
var grappling = false
|
||||||
|
|
||||||
|
var grapples = 0
|
||||||
|
|
||||||
|
var grappleShootParti = preload("res://Particles/Grapple/GrappleParti.tscn")
|
||||||
|
|
||||||
|
func renderLine(proj):
|
||||||
|
var grappleLine = proj.get_node("GrappleLine")
|
||||||
|
var grappleBord = proj.get_node("GrappleBord")
|
||||||
|
|
||||||
|
var grapOffset = grappleCore.offset * sprite.scale
|
||||||
|
|
||||||
|
grappleLine.set_point_position(1, player.position + grapOffset)
|
||||||
|
grappleBord.set_point_position(1, player.position + grapOffset)
|
||||||
|
|
||||||
|
grappleLine.set_point_position(0, proj.position)
|
||||||
|
grappleBord.set_point_position(0, proj.position)
|
||||||
|
|
||||||
|
var curve = Curve.new()
|
||||||
|
curve.add_point(Vector2(0, 1))
|
||||||
|
curve.add_point(Vector2(1, sprite.scale.y))
|
||||||
|
|
||||||
|
grappleLine.width_curve = curve
|
||||||
|
grappleBord.width_curve = curve
|
||||||
|
|
||||||
|
func launch(delta):
|
||||||
|
if proj:
|
||||||
|
player.jumps = player.MAX_JUMPS - 1
|
||||||
|
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, 2000))
|
||||||
|
grappleDur = 0.1
|
||||||
|
grappling = true
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
if not Input.is_action_pressed("pullGrapple"):
|
||||||
|
grappleDur -= delta
|
||||||
|
|
||||||
|
var moveVector = (get_global_mouse_position() - player.position).normalized()
|
||||||
|
|
||||||
|
if player.is_on_floor():
|
||||||
|
grapples = 2
|
||||||
|
|
||||||
|
#$"parti".emitting = grappling
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("pullGrapple") and not proj and grapples:
|
||||||
|
grapples -= 1
|
||||||
|
|
||||||
|
proj = grappleProjectile.instantiate()
|
||||||
|
|
||||||
|
proj.position = player.position
|
||||||
|
proj.rotation = moveVector.angle()
|
||||||
|
|
||||||
|
modulate = Color8(0, 255, 150)
|
||||||
|
proj.modulate = modulate
|
||||||
|
|
||||||
|
proj.velocity = (moveVector * (1500 + player.velocity.dot(moveVector))) #+ (player.velocity.normalized() * player.velocity.dot(moveVector))
|
||||||
|
print(player.velocity.dot(moveVector))
|
||||||
|
#grappleDur = 10
|
||||||
|
add_child(proj)
|
||||||
|
|
||||||
|
#var parti = grappleShootParti.instantiate()
|
||||||
|
#parti.rotation = proj.rotation
|
||||||
|
#parti.position = proj.position
|
||||||
|
#parti.process_material.initial_velocity_min = (proj.velocity.length() + player.velocity.length()) / 6
|
||||||
|
#add_child(parti)
|
||||||
|
#else:
|
||||||
|
|
||||||
|
if proj and grappleDur > 0 and (player.position - proj.position).length() > 15 and not Input.is_action_just_pressed("jump"):
|
||||||
|
launch(delta)
|
||||||
|
elif proj and grappling:
|
||||||
|
player.jumps = player.MAX_JUMPS
|
||||||
|
player.falling = false
|
||||||
|
#player.velocity.y = player.JUMP_VELOCITY
|
||||||
|
grappleDur = 0
|
||||||
|
|
||||||
|
retractingProj.append({"proj": proj, "retractStart": proj.position, "retractDur": 0})
|
||||||
|
proj = null
|
||||||
|
grappling = false
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
for projData in retractingProj:
|
||||||
|
var proj = projData.proj
|
||||||
|
if is_instance_valid(proj):
|
||||||
|
proj.position = lerp(projData.retractStart, player.position, projData.retractDur)
|
||||||
|
projData.retractDur += delta * 4 / ((projData.retractStart - player.position).length() / 300)
|
||||||
|
renderLine(proj)
|
||||||
|
if projData.retractDur >= 1:
|
||||||
|
if proj.find_child("parti"):
|
||||||
|
var parti = proj.get_node("parti")
|
||||||
|
parti.emitting = false
|
||||||
|
parti.reparent(self)
|
||||||
|
proj.queue_free()
|
||||||
|
proj = null
|
||||||
|
retractDur = 0
|
||||||
|
else:
|
||||||
|
retractingProj.remove_at(retractingProj.find(projData))
|
||||||
|
|
||||||
|
if is_instance_valid(proj):
|
||||||
|
renderLine(proj)
|
||||||
|
|
BIN
Player/GrappleHook/GrappleHookProjectile/Grapple.png
Normal file
After Width: | Height: | Size: 164 B |
34
Player/GrappleHook/GrappleHookProjectile/Grapple.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bncu47o5ynskj"
|
||||||
|
path="res://.godot/imported/Grapple.png-feaba7449a5f3ea3aa251c5a08ccef36.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Player/GrappleHook/GrappleHookProjectile/Grapple.png"
|
||||||
|
dest_files=["res://.godot/imported/Grapple.png-feaba7449a5f3ea3aa251c5a08ccef36.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
|
|
@ -0,0 +1,52 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
var lifeTime = 0.6
|
||||||
|
|
||||||
|
@onready var parent = get_parent()
|
||||||
|
|
||||||
|
var lastPos = null
|
||||||
|
|
||||||
|
var detecting = true
|
||||||
|
|
||||||
|
var partiDebounce = true
|
||||||
|
|
||||||
|
var target = null
|
||||||
|
var bodyOffset = Vector2.ZERO
|
||||||
|
|
||||||
|
func objectHit(body):
|
||||||
|
if body != self:
|
||||||
|
velocity = Vector2.ZERO
|
||||||
|
parent.grappleStart()
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
if not lastPos:
|
||||||
|
lastPos = position
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
|
if find_child("parti"):
|
||||||
|
$"parti".emitting = (lastPos - position).length() > 0
|
||||||
|
|
||||||
|
if detecting:
|
||||||
|
if lifeTime <= 0:
|
||||||
|
velocity = -velocity
|
||||||
|
parent.retractingProj.append({"proj": self, "retractStart": position, "retractDur": 0})
|
||||||
|
parent.grappling = false
|
||||||
|
parent.proj = null
|
||||||
|
detecting = false
|
||||||
|
lifeTime -= delta
|
||||||
|
var space_state = get_world_2d().direct_space_state
|
||||||
|
|
||||||
|
var query = PhysicsRayQueryParameters2D.create(lastPos, position, 3, [parent.get_parent().get_parent()])
|
||||||
|
var result = space_state.intersect_ray(query)
|
||||||
|
|
||||||
|
if result:
|
||||||
|
detecting = false
|
||||||
|
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 = global_position
|
|
@ -0,0 +1,74 @@
|
||||||
|
[gd_scene load_steps=7 format=3 uid="uid://dmgf8fsvy1wjh"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://Player/GrappleHook/GrappleHookProjectile/GrappleHookProjectile.gd" id="1_nba88"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bncu47o5ynskj" path="res://Player/GrappleHook/GrappleHookProjectile/Grapple.png" id="2_sst4t"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://gn347ng3iu02" path="res://Player/GrappleHook/GrappleHookProjectile/GrappleTether.png" id="2_xkdsl"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_qnwwb"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -2.51429, 0.0, 0, 0]
|
||||||
|
point_count = 2
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_h7vvv"]
|
||||||
|
curve = SubResource("Curve_qnwwb")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_tkwr2"]
|
||||||
|
particle_flag_align_y = true
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
inherit_velocity_ratio = -0.1
|
||||||
|
direction = Vector3(0, 1, 0)
|
||||||
|
spread = 180.0
|
||||||
|
flatness = 1.0
|
||||||
|
initial_velocity_min = 50.0
|
||||||
|
initial_velocity_max = 50.0
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
damping_min = 50.0
|
||||||
|
damping_max = 50.0
|
||||||
|
scale_max = 2.0
|
||||||
|
scale_curve = SubResource("CurveTexture_h7vvv")
|
||||||
|
|
||||||
|
[node name="GrappleHook" type="CharacterBody2D"]
|
||||||
|
top_level = true
|
||||||
|
disable_mode = 2
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 0
|
||||||
|
motion_mode = 1
|
||||||
|
platform_floor_layers = 4294967040
|
||||||
|
script = ExtResource("1_nba88")
|
||||||
|
|
||||||
|
[node name="Sprite" type="Sprite2D" parent="."]
|
||||||
|
z_index = 4
|
||||||
|
texture = ExtResource("2_sst4t")
|
||||||
|
|
||||||
|
[node name="GrappleLine" type="Line2D" parent="."]
|
||||||
|
top_level = true
|
||||||
|
z_index = 2
|
||||||
|
texture_repeat = 2
|
||||||
|
points = PackedVector2Array(0, 0, 33, 0)
|
||||||
|
width = 4.0
|
||||||
|
texture = ExtResource("2_xkdsl")
|
||||||
|
texture_mode = 1
|
||||||
|
joint_mode = 2
|
||||||
|
begin_cap_mode = 2
|
||||||
|
end_cap_mode = 2
|
||||||
|
round_precision = 4
|
||||||
|
|
||||||
|
[node name="GrappleBord" type="Line2D" parent="."]
|
||||||
|
modulate = Color(0, 0, 0, 1)
|
||||||
|
top_level = true
|
||||||
|
z_index = 1
|
||||||
|
texture_repeat = 2
|
||||||
|
points = PackedVector2Array(0, 0, 33, 0)
|
||||||
|
width = 6.0
|
||||||
|
texture_mode = 1
|
||||||
|
joint_mode = 2
|
||||||
|
begin_cap_mode = 2
|
||||||
|
end_cap_mode = 2
|
||||||
|
round_precision = 4
|
||||||
|
|
||||||
|
[node name="parti" type="GPUParticles2D" parent="."]
|
||||||
|
amount = 200
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_tkwr2")
|
||||||
|
lifetime = 2.0
|
||||||
|
fixed_fps = 0
|
||||||
|
interpolate = false
|
||||||
|
visibility_rect = Rect2(-12500, -12500, 25000, 25000)
|
BIN
Player/GrappleHook/GrappleHookProjectile/GrappleTether.kra
Normal file
BIN
Player/GrappleHook/GrappleHookProjectile/GrappleTether.png
Normal file
After Width: | Height: | Size: 133 B |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://gn347ng3iu02"
|
||||||
|
path="res://.godot/imported/GrappleTether.png-070f72f0eebbe08ec00dac245679c61b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Player/GrappleHook/GrappleHookProjectile/GrappleTether.png"
|
||||||
|
dest_files=["res://.godot/imported/GrappleTether.png-070f72f0eebbe08ec00dac245679c61b.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
Player/GrappleHook/GrappleHookProjectile/GrappleTether.png~
Normal file
After Width: | Height: | Size: 143 B |