parent
630670d5b1
commit
bde3cc5976
@ -1,11 +1,16 @@
|
|||||||
[gd_scene format=3 uid="uid://bc3i3udumnh3r"]
|
[gd_scene load_steps=2 format=3 uid="uid://bc3i3udumnh3r"]
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
[ext_resource type="Script" path="res://scripts/Main.gd" id="1_wd8h7"]
|
||||||
|
|
||||||
[node name="Game" type="CanvasLayer" parent="."]
|
[node name="Main" type="Node2D"]
|
||||||
|
script = ExtResource("1_wd8h7")
|
||||||
|
|
||||||
|
[node name="Game" type="Node2D" parent="."]
|
||||||
|
|
||||||
[node name="UI" type="CanvasLayer" parent="."]
|
[node name="UI" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[node name="Splash" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
[node name="Curtains" type="CanvasLayer" parent="."]
|
[node name="Curtains" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
[node name="Post" type="CanvasLayer" parent="."]
|
[node name="Post" type="CanvasLayer" parent="."]
|
||||||
|
|||||||
@ -0,0 +1,164 @@
|
|||||||
|
[gd_scene load_steps=14 format=3 uid="uid://cqa6qtn1lj53m"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/Player.gd" id="1_str71"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cuyel4kvgrcov" path="res://audio/jump.wav" id="2_w5kyr"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3db0b"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_qv6th"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("CollisionShape2D:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("CollisionShape2D:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_37igj"]
|
||||||
|
resource_name = "jump"
|
||||||
|
length = 0.5
|
||||||
|
step = 0.05
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("CollisionShape2D:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.05, 0.15),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1), Vector2(1.5, 0.5), Vector2(0.6, 1.4)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("CollisionShape2D:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.05, 0.15),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, 0), Vector2(0, 4), Vector2(0, -4)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_caret"]
|
||||||
|
resource_name = "land"
|
||||||
|
length = 0.5
|
||||||
|
step = 0.05
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("CollisionShape2D:scale")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.15),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0.6, 1.4), Vector2(1.5, 0.5), Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("CollisionShape2D:position")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.1, 0.15),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(0, -4), Vector2(0, 4), Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_x6ekt"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_qv6th"),
|
||||||
|
"jump": SubResource("Animation_37igj"),
|
||||||
|
"land": SubResource("Animation_caret")
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_pnajy"]
|
||||||
|
radius = 4.0
|
||||||
|
height = 16.0
|
||||||
|
|
||||||
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_oeovl"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_v0kkc"]
|
||||||
|
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.14486, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||||
|
point_count = 3
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_k65h6"]
|
||||||
|
curve = SubResource("Curve_v0kkc")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_fswit"]
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
gravity = Vector3(0, 98, 0)
|
||||||
|
scale_min = 4.0
|
||||||
|
scale_max = 4.0
|
||||||
|
alpha_curve = SubResource("CurveTexture_k65h6")
|
||||||
|
turbulence_noise_strength = 10.49
|
||||||
|
turbulence_noise_scale = 50.0
|
||||||
|
sub_emitter_keep_velocity = true
|
||||||
|
|
||||||
|
[sub_resource type="PrismMesh" id="PrismMesh_43iim"]
|
||||||
|
lightmap_size_hint = Vector2i(14, 21)
|
||||||
|
size = Vector3(2, 2, 0)
|
||||||
|
|
||||||
|
[node name="Player" type="CharacterBody2D"]
|
||||||
|
material = SubResource("ShaderMaterial_3db0b")
|
||||||
|
collision_layer = 3
|
||||||
|
collision_mask = 3
|
||||||
|
script = ExtResource("1_str71")
|
||||||
|
metadata/_edit_group_ = true
|
||||||
|
metadata/_edit_horizontal_guides_ = [8.0]
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
deterministic = true
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_x6ekt")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("2_w5kyr")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CapsuleShape2D_pnajy")
|
||||||
|
|
||||||
|
[node name="GPUParticles2D" type="GPUParticles2D" parent="CollisionShape2D"]
|
||||||
|
material = SubResource("CanvasItemMaterial_oeovl")
|
||||||
|
position = Vector2(0, -4)
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_fswit")
|
||||||
|
lifetime = 0.5
|
||||||
|
trail_lifetime = 3.78
|
||||||
|
trail_sections = 48
|
||||||
|
trail_section_subdivisions = 1
|
||||||
|
|
||||||
|
[node name="MeshInstance2D" type="MeshInstance2D" parent="CollisionShape2D"]
|
||||||
|
rotation = -3.14159
|
||||||
|
scale = Vector2(8, 8)
|
||||||
|
mesh = SubResource("PrismMesh_43iim")
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
limit_smoothed = true
|
||||||
|
position_smoothing_enabled = true
|
||||||
|
rotation_smoothing_enabled = true
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var dir: int
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
@ -1,11 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://bc3i3udumnh3r"]
|
|
||||||
|
|
||||||
[node name="Main" type="Node"]
|
|
||||||
|
|
||||||
[node name="Game" type="CanvasLayer" parent="."]
|
|
||||||
|
|
||||||
[node name="UI" type="CanvasLayer" parent="."]
|
|
||||||
|
|
||||||
[node name="Curtains" type="CanvasLayer" parent="."]
|
|
||||||
|
|
||||||
[node name="Post" type="CanvasLayer" parent="."]
|
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
[gd_scene load_steps=9 format=3 uid="uid://dvt585i7m0286"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/tools/between2.gd" id="1_o5ti7"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/Splash.gd" id="1_tnoah"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bc3i3udumnh3r" path="res://scenes/Main.tscn" id="2_dq85p"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cihjayxr028j3" path="res://icon.svg" id="2_fpfqa"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dfqspackuotur" path="res://scenes/ui/fade.tscn" id="4_hn3xu"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_sdvqp"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "bezier"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Logo:weight")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0),
|
||||||
|
"points": PackedFloat32Array(0.5, -0.25, 0, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0)
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Black:color")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_2v5v3"]
|
||||||
|
resource_name = "animation"
|
||||||
|
length = 3.0
|
||||||
|
tracks/0/type = "bezier"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("Logo:weight")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"handle_modes": PackedInt32Array(0, 0, 0, 0),
|
||||||
|
"points": PackedFloat32Array(0, -0.25, 0, 0.0947368, 0.323529, 0.5, -0.366629, 0.00130719, 0.25, 0, 0.5, -0.25, 0, 0.25, 0, 1, -0.105263, -0.344444, 0.25, 0),
|
||||||
|
"times": PackedFloat32Array(0.5, 1, 2, 2.5)
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("Black:color")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.5, 2.5, 3),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0), Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sansa"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_sdvqp"),
|
||||||
|
"animation": SubResource("Animation_2v5v3")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Main" type="CanvasLayer"]
|
||||||
|
follow_viewport_enabled = true
|
||||||
|
script = ExtResource("1_tnoah")
|
||||||
|
res = ExtResource("2_dq85p")
|
||||||
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
|
[node name="in" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 4
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="out" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 6
|
||||||
|
anchor_left = 1.0
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 2
|
||||||
|
metadata/_edit_use_anchors_ = true
|
||||||
|
|
||||||
|
[node name="Logo" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
rotation = -6.28318
|
||||||
|
script = ExtResource("1_o5ti7")
|
||||||
|
weight = 0.5
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="Logo"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = -96.0
|
||||||
|
offset_top = -96.0
|
||||||
|
offset_right = 96.0
|
||||||
|
offset_bottom = 96.0
|
||||||
|
texture = ExtResource("2_fpfqa")
|
||||||
|
|
||||||
|
[node name="Black" parent="." instance=ExtResource("4_hn3xu")]
|
||||||
|
script = null
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_sansa")
|
||||||
|
}
|
||||||
|
autoplay = "animation"
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://dfqspackuotur"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/tools/fade.gd" id="1_i8eyl"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_7acmb"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_iqj70"]
|
||||||
|
resource_name = "fade_in"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(),
|
||||||
|
"transitions": PackedFloat32Array(),
|
||||||
|
"values": []
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_x5jw3"]
|
||||||
|
resource_name = "fade_out"
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 1),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ejj8p"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_7acmb"),
|
||||||
|
"fade_in": SubResource("Animation_iqj70"),
|
||||||
|
"fade_out": SubResource("Animation_x5jw3")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Black" type="ColorRect"]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color(0, 0, 0, 1)
|
||||||
|
script = ExtResource("1_i8eyl")
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
"": SubResource("AnimationLibrary_ejj8p")
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var G: Node2D
|
||||||
|
var L: Node2D
|
||||||
|
var P: CharacterBody2D
|
||||||
|
|
||||||
|
var curr_lives: int = PDash.STARTING_LIVES
|
||||||
|
var curr_lvl: int = 1
|
||||||
|
|
||||||
|
func load_lvl( lvl_index: int ):
|
||||||
|
var lvl_path = PDash.lvl_paths[ lvl_index-1 ]
|
||||||
|
var lvl: Node = load( lvl_path ).instantiate()
|
||||||
|
G.add_child( lvl )
|
||||||
|
L = $Game/Level
|
||||||
|
|
||||||
|
func load_plyr():
|
||||||
|
var plyr = load("res://scenes/Player.tscn").instantiate()
|
||||||
|
G.add_child( plyr )
|
||||||
|
P = $Game/Player
|
||||||
|
|
||||||
|
func init_plyr():
|
||||||
|
P.set_gravity_vector( Vector2(0,1) )
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
G = $Game
|
||||||
|
|
||||||
|
PDash.fade( "in" , 1 )
|
||||||
|
|
||||||
|
load_lvl(curr_lvl)
|
||||||
|
load_plyr()
|
||||||
|
init_plyr()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
var game_name: String = "pDash"
|
||||||
|
var game_version: float = 0.1
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
var lvl_paths: Array[String] = [
|
||||||
|
"res://scenes/levels/level_0.tscn",
|
||||||
|
"res://scenes/levels/level_1.tscn"
|
||||||
|
]
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
const STARTING_LIVES: int = 3
|
||||||
|
|
||||||
|
## Preferences
|
||||||
|
var show_splash: bool = false
|
||||||
|
|
||||||
|
func fade( type: String , t: float ):
|
||||||
|
var fade = load("res://scenes/ui/fade.tscn").instantiate();
|
||||||
|
if type == "in":
|
||||||
|
fade.type = 0
|
||||||
|
elif type == "out":
|
||||||
|
fade.type = 1
|
||||||
|
fade.speed = 1/t
|
||||||
|
get_node("/root/Main/Curtains").add_child( fade )
|
||||||
|
|
||||||
|
func splash():
|
||||||
|
var splash = load("res://scenes/ui/Splash.tscn").instantiate();
|
||||||
|
get_node("/root/Main/Splash").add_child( splash )
|
||||||
|
await splash.get_node("AnimationPlayer").animation_finished
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
const SPEED = 300
|
||||||
|
const JUMP_VELOCITY = -400.0
|
||||||
|
const ANGULAR_ACCELERATION = 7.5;
|
||||||
|
|
||||||
|
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||||
|
var gravity_vector: Vector2
|
||||||
|
var direction: int = 1
|
||||||
|
var World: Node2D
|
||||||
|
var ap: AnimationPlayer
|
||||||
|
var asp: AudioStreamPlayer
|
||||||
|
var cam: Camera2D
|
||||||
|
|
||||||
|
var jumping: bool = false
|
||||||
|
var lives: int = 3
|
||||||
|
|
||||||
|
var jump_sound = preload("res://audio/jump.wav")
|
||||||
|
var land_sound = preload("res://audio/land.wav")
|
||||||
|
var fall_sound = preload("res://audio/fall.wav")
|
||||||
|
var switch_direction_sound = preload("res://audio/switch_direction.wav")
|
||||||
|
|
||||||
|
|
||||||
|
func switch_direction():
|
||||||
|
velocity.x *= -1
|
||||||
|
set_direction( direction * -1 )
|
||||||
|
asp.stream = switch_direction_sound
|
||||||
|
asp.play()
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
ap = $AnimationPlayer;
|
||||||
|
asp = $AudioStreamPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
## Setters
|
||||||
|
func set_direction( d: int ):
|
||||||
|
direction = d
|
||||||
|
|
||||||
|
func set_gravity_vector( gv: Vector2 ):
|
||||||
|
gravity_vector = gv
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("debug"):
|
||||||
|
switch_direction()
|
||||||
|
#if direction != World.direction:
|
||||||
|
#swap_direction()
|
||||||
|
|
||||||
|
# Add the gravity.
|
||||||
|
self.up_direction = -gravity_vector;
|
||||||
|
$CollisionShape2D.skew = lerp( $CollisionShape2D.skew, (.001) * self.velocity.x * sin(gravity_vector.angle()) , delta * ANGULAR_ACCELERATION )
|
||||||
|
self.rotation = lerp( self.rotation , -gravity_vector.angle() + (.5*PI) , delta * ANGULAR_ACCELERATION ) ;
|
||||||
|
|
||||||
|
|
||||||
|
if not is_on_floor():
|
||||||
|
velocity.y += gravity * (sin(gravity_vector.angle())) * delta
|
||||||
|
velocity.x += gravity * (cos(gravity_vector.angle())) * delta
|
||||||
|
else:
|
||||||
|
# Handle jump.
|
||||||
|
|
||||||
|
if jumping:
|
||||||
|
jumping = false
|
||||||
|
ap.play("land")
|
||||||
|
asp.stream = land_sound
|
||||||
|
asp.play()
|
||||||
|
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("jump") and is_on_floor():
|
||||||
|
#velocity.x = JUMP_VELOCITY * cos(jump_vector.angle())
|
||||||
|
jumping = true
|
||||||
|
ap.play("jump")
|
||||||
|
asp.stream = jump_sound
|
||||||
|
asp.play()
|
||||||
|
|
||||||
|
velocity.y = JUMP_VELOCITY * sin(gravity_vector.angle())
|
||||||
|
|
||||||
|
if direction != 0:
|
||||||
|
velocity.x = direction * SPEED
|
||||||
|
else:
|
||||||
|
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
|
|
||||||
|
func _on_activate_camera():
|
||||||
|
cam.make_current()
|
||||||
|
|
||||||
|
func _on_fall():
|
||||||
|
asp.stream = fall_sound
|
||||||
|
asp.play()
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
extends CanvasLayer
|
||||||
|
@export var res: Resource
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if PDash.show_splash:
|
||||||
|
await $AnimationPlayer.animation_finished
|
||||||
|
get_tree().change_scene_to_packed( res )
|
||||||
|
#queue_free()
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
extends Control
|
||||||
|
var in_p : Vector2
|
||||||
|
var out_p : Vector2
|
||||||
|
var width : float
|
||||||
|
@export var weight : float
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
in_p = $"../in".position
|
||||||
|
out_p = $"../out".position
|
||||||
|
width = $TextureRect.texture.get_size().x
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
position = lerp(in_p -Vector2( width ,0 ), out_p +Vector2( width ,0 ),weight)
|
||||||
|
pass
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
extends ColorRect
|
||||||
|
@export var type: int = 0
|
||||||
|
@export var speed: float = 1
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if type == 0:
|
||||||
|
$AnimationPlayer.play("fade_in")
|
||||||
|
elif type == 1:
|
||||||
|
$AnimationPlayer.play("fade_out")
|
||||||
|
|
||||||
|
$AnimationPlayer.speed_scale = speed
|
||||||
|
await $AnimationPlayer.animation_finished
|
||||||
|
queue_free()
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
Loading…
Reference in new issue