From 1eee8b0e9268f46fe8409bb7624a2218b5c973fb Mon Sep 17 00:00:00 2001 From: sstone Date: Sat, 3 Oct 2026 17:45:38 -0600 Subject: [PATCH] Casset/level1 made a casset that you can pick up. Made a level 1. --- Globla_Data.gd | 3 + casset.gd | 10 + casset.gd.uid | 1 + scenes/casset.tscn | 21 ++ scenes/levels/level1.tscn | 296 +++++++----------------- scenes/levels/level_1.gd | 15 ++ scenes/levels/level_1.gd.uid | 1 + scenes/player.tscn | 27 ++- scenes/puzzles/phonephreak.tscn | 31 +-- scenes/test_scene.tscn | 6 +- scripts/UltimatePlatformerController.gd | 235 ++++++++++--------- 11 files changed, 297 insertions(+), 349 deletions(-) create mode 100644 casset.gd create mode 100644 casset.gd.uid create mode 100644 scenes/casset.tscn create mode 100644 scenes/levels/level_1.gd create mode 100644 scenes/levels/level_1.gd.uid diff --git a/Globla_Data.gd b/Globla_Data.gd index b829a8d..f987a10 100644 --- a/Globla_Data.gd +++ b/Globla_Data.gd @@ -3,4 +3,7 @@ extends Node @onready var test_level = $"../test_scene" @onready var projectile = $"../projectile" +@onready var level_1 = $"../Level1" var death_counter = 3 +var cassets = 0 +var doing_puzzle: bool = false diff --git a/casset.gd b/casset.gd new file mode 100644 index 0000000..51b1452 --- /dev/null +++ b/casset.gd @@ -0,0 +1,10 @@ +extends Node2D + + +var points = 0 + + +func _on_body_entered(body: Node2D) -> void: + queue_free() + GloblaData.cassets += 1 + print("1 point") diff --git a/casset.gd.uid b/casset.gd.uid new file mode 100644 index 0000000..ceadc10 --- /dev/null +++ b/casset.gd.uid @@ -0,0 +1 @@ +uid://bjj8m1jv577ob diff --git a/scenes/casset.tscn b/scenes/casset.tscn new file mode 100644 index 0000000..5101c94 --- /dev/null +++ b/scenes/casset.tscn @@ -0,0 +1,21 @@ +[gd_scene format=3 uid="uid://c17txy4vh4wka"] + +[ext_resource type="Script" uid="uid://bjj8m1jv577ob" path="res://casset.gd" id="1_n02yi"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"] +size = Vector2(47, 25) + +[node name="casset" type="Area2D" unique_id=918954585] +collision_layer = 16 +script = ExtResource("1_n02yi") + +[node name="ColorRect" type="ColorRect" parent="." unique_id=2007285166] +offset_right = 47.0 +offset_bottom = 25.0 +color = Color(0, 0, 0, 1) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1414004718] +position = Vector2(23.5, 12.5) +shape = SubResource("RectangleShape2D_aqe1g") + +[connection signal="body_entered" from="." to="." method="_on_body_entered"] diff --git a/scenes/levels/level1.tscn b/scenes/levels/level1.tscn index 3e448e2..91b94e5 100644 --- a/scenes/levels/level1.tscn +++ b/scenes/levels/level1.tscn @@ -1,229 +1,89 @@ [gd_scene format=3 uid="uid://byyncg030v5uf"] -[ext_resource type="Texture2D" uid="uid://bt61g6xdrepd" path="res://assets/sprites/knight.png" id="1_4tcl0"] -[ext_resource type="TileSet" uid="uid://bcmaud87chfuu" path="res://assets/sprites/knight.tres" id="2_dd0lh"] +[ext_resource type="Script" uid="uid://cogpyoqdfygvg" path="res://scenes/levels/level_1.gd" id="1_bfxgj"] +[ext_resource type="PackedScene" uid="uid://cmtdq6tedv1mm" path="res://scenes/player.tscn" id="1_dd0lh"] +[ext_resource type="PackedScene" uid="uid://dxx6mxv6x5yws" path="res://scenes/enemy.tscn" id="2_bfxgj"] +[ext_resource type="PackedScene" uid="uid://c17txy4vh4wka" path="res://scenes/casset.tscn" id="3_dywbp"] -[sub_resource type="AtlasTexture" id="AtlasTexture_bfxgj"] -atlas = ExtResource("1_4tcl0") -region = Rect2(0, 0, 32, 32) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"] +size = Vector2(6598.25, 171) -[sub_resource type="AtlasTexture" id="AtlasTexture_dywbp"] -atlas = ExtResource("1_4tcl0") -region = Rect2(32, 0, 32, 32) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_yg5ta"] +size = Vector2(787, 135) -[sub_resource type="AtlasTexture" id="AtlasTexture_1seuy"] -atlas = ExtResource("1_4tcl0") -region = Rect2(64, 0, 32, 32) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_e270b"] +size = Vector2(341, 630) -[sub_resource type="AtlasTexture" id="AtlasTexture_2r1tl"] -atlas = ExtResource("1_4tcl0") -region = Rect2(96, 0, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_8a7m2"] -atlas = ExtResource("1_4tcl0") -region = Rect2(0, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_plydf"] -atlas = ExtResource("1_4tcl0") -region = Rect2(32, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_5ntmo"] -atlas = ExtResource("1_4tcl0") -region = Rect2(64, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_nkeig"] -atlas = ExtResource("1_4tcl0") -region = Rect2(96, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_nfihu"] -atlas = ExtResource("1_4tcl0") -region = Rect2(128, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_lgguw"] -atlas = ExtResource("1_4tcl0") -region = Rect2(160, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_jprdt"] -atlas = ExtResource("1_4tcl0") -region = Rect2(192, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_ps2vj"] -atlas = ExtResource("1_4tcl0") -region = Rect2(224, 160, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_sbmf2"] -atlas = ExtResource("1_4tcl0") -region = Rect2(0, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_1xax6"] -atlas = ExtResource("1_4tcl0") -region = Rect2(32, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_g7tkf"] -atlas = ExtResource("1_4tcl0") -region = Rect2(64, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_4fww7"] -atlas = ExtResource("1_4tcl0") -region = Rect2(96, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_gvm5i"] -atlas = ExtResource("1_4tcl0") -region = Rect2(128, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_jrfo0"] -atlas = ExtResource("1_4tcl0") -region = Rect2(160, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_db1r7"] -atlas = ExtResource("1_4tcl0") -region = Rect2(192, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_6gwlt"] -atlas = ExtResource("1_4tcl0") -region = Rect2(224, 64, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_c2nc4"] -atlas = ExtResource("1_4tcl0") -region = Rect2(0, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_vhxpm"] -atlas = ExtResource("1_4tcl0") -region = Rect2(32, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_arkx4"] -atlas = ExtResource("1_4tcl0") -region = Rect2(64, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_jqv5m"] -atlas = ExtResource("1_4tcl0") -region = Rect2(96, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_noix2"] -atlas = ExtResource("1_4tcl0") -region = Rect2(128, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_025c5"] -atlas = ExtResource("1_4tcl0") -region = Rect2(160, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_bw3ef"] -atlas = ExtResource("1_4tcl0") -region = Rect2(192, 96, 32, 32) - -[sub_resource type="AtlasTexture" id="AtlasTexture_07dy8"] -atlas = ExtResource("1_4tcl0") -region = Rect2(224, 96, 32, 32) - -[sub_resource type="SpriteFrames" id="SpriteFrames_d53c6"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_bfxgj") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_dywbp") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_1seuy") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_2r1tl") -}], -"loop": 1, -"name": &"Idle", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_8a7m2") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_plydf") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_5ntmo") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_nkeig") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_nfihu") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_lgguw") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_jprdt") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_ps2vj") -}], -"loop": 1, -"name": &"Roll", -"speed": 5.0 -}, { -"frames": [{ -"duration": 1.0, -"texture": SubResource("AtlasTexture_sbmf2") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_1xax6") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_g7tkf") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_4fww7") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_gvm5i") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_jrfo0") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_db1r7") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_6gwlt") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_c2nc4") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_vhxpm") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_arkx4") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_jqv5m") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_noix2") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_025c5") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_bw3ef") -}, { -"duration": 1.0, -"texture": SubResource("AtlasTexture_07dy8") -}], -"loop": 1, -"name": &"Run", -"speed": 5.0 -}] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_xfo6b"] +size = Vector2(74, 1107) [node name="Level1" type="Node2D" unique_id=872996404] +script = ExtResource("1_bfxgj") -[node name="CharacterBody2D" type="CharacterBody2D" parent="." unique_id=702674080] +[node name="ColorRect" type="ColorRect" parent="." unique_id=875566885] +offset_top = 269.0 +offset_right = 6588.0 +offset_bottom = 368.0 +color = Color(0, 0.39215687, 0, 1) -[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="CharacterBody2D" unique_id=1742472414] -sprite_frames = SubResource("SpriteFrames_d53c6") -animation = &"Roll" +[node name="ColorRect2" type="ColorRect" parent="." unique_id=170644068] +offset_left = 1250.0 +offset_top = -129.0 +offset_right = 2039.0 +offset_bottom = 6.0 +color = Color(0, 0.39215687, 0, 1) -[node name="TileMapLayer" type="TileMapLayer" parent="CharacterBody2D/AnimatedSprite2D" unique_id=1046286093] -tile_set = ExtResource("2_dd0lh") +[node name="ColorRect3" type="ColorRect" parent="." unique_id=1127267083] +offset_top = 269.0 +offset_right = 4761.0 +offset_bottom = 368.0 +color = Color(0, 0.39215687, 0, 1) + +[node name="ColorRect4" type="ColorRect" parent="." unique_id=1994208535] +offset_left = 4215.0 +offset_top = -358.0 +offset_right = 4563.0 +offset_bottom = 267.0 +color = Color(0, 0.39215687, 0, 1) + +[node name="player" parent="." unique_id=1596338883 instance=ExtResource("1_dd0lh")] +position = Vector2(4730, 39) + +[node name="enemy" parent="." unique_id=1471932521 instance=ExtResource("2_bfxgj")] +position = Vector2(1304, -293) + +[node name="enemy2" parent="." unique_id=631693255 instance=ExtResource("2_bfxgj")] +position = Vector2(3028, 91) + +[node name="casset" parent="." unique_id=918954585 instance=ExtResource("3_dywbp")] +position = Vector2(4342, -430) + +[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=1033326926] +collision_layer = 2 +collision_mask = 5 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" unique_id=2093286666] +position = Vector2(3292.875, 355) +shape = SubResource("RectangleShape2D_aqe1g") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D" unique_id=162193919] +position = Vector2(1644.5, -61.5) +shape = SubResource("RectangleShape2D_yg5ta") + +[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D" unique_id=837904529] +position = Vector2(4385.5, -42) +shape = SubResource("RectangleShape2D_e270b") + +[node name="Area2D" type="Area2D" parent="." unique_id=1173036271] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=857196107] +position = Vector2(5795, -306) +shape = SubResource("RectangleShape2D_xfo6b") + +[node name="Marker2D" type="Marker2D" parent="." unique_id=1804380766] +position = Vector2(5418, -140) + +[node name="Marker2D2" type="Marker2D" parent="." unique_id=726852992] +position = Vector2(5756, 192) + +[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/scenes/levels/level_1.gd b/scenes/levels/level_1.gd new file mode 100644 index 0000000..d526a2c --- /dev/null +++ b/scenes/levels/level_1.gd @@ -0,0 +1,15 @@ +extends Node2D + + +@onready var phonephreak = preload("res://scenes/puzzles/phonephreak.tscn") + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + + +func _on_area_2d_body_entered(body: Node2D) -> void: + GloblaData.doing_puzzle = true + var instance = phonephreak.instantiate() + $Marker2D.add_child(instance) diff --git a/scenes/levels/level_1.gd.uid b/scenes/levels/level_1.gd.uid new file mode 100644 index 0000000..b2044fa --- /dev/null +++ b/scenes/levels/level_1.gd.uid @@ -0,0 +1 @@ +uid://cogpyoqdfygvg diff --git a/scenes/player.tscn b/scenes/player.tscn index 372ef99..bd990a6 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,12 +1,14 @@ [gd_scene format=3 uid="uid://cmtdq6tedv1mm"] [ext_resource type="Script" uid="uid://2ig5okof0vaa" path="res://scripts/UltimatePlatformerController.gd" id="1_3vyb7"] +[ext_resource type="FontFile" uid="uid://ddm6ojsaiq20b" path="res://assets/fonts/PixelOperator8-Bold.ttf" id="2_g2els"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_d2by0"] size = Vector2(111, 105) [node name="player" type="CharacterBody2D" unique_id=1596338883] -collision_mask = 6 +position = Vector2(510, 410) +collision_mask = 22 script = ExtResource("1_3vyb7") [node name="ColorRect" type="ColorRect" parent="." unique_id=1060028972] @@ -16,7 +18,7 @@ offset_bottom = 104.0 [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=440932344] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1496788104] -position = Vector2(55.5, 52.5) +position = Vector2(56, 52) shape = SubResource("RectangleShape2D_d2by0") [node name="ColorRect2" type="ColorRect" parent="." unique_id=1595777933] @@ -42,3 +44,24 @@ color = Color(1, 0, 0, 1) [node name="Marker2D" type="Marker2D" parent="." unique_id=1559032825] position = Vector2(112, 38) + +[node name="Camera2D" type="Camera2D" parent="." unique_id=2084265989] +position = Vector2(57, 54) + +[node name="Label" type="Label" parent="." unique_id=519077191] +offset_left = -314.0 +offset_top = -265.0 +offset_right = -281.0 +offset_bottom = -231.0 +theme_override_fonts/font = ExtResource("2_g2els") +theme_override_font_sizes/font_size = 25 +text = "0" + +[node name="Label2" type="Label" parent="." unique_id=1907510281] +offset_left = -516.0 +offset_top = -266.0 +offset_right = -264.0 +offset_bottom = -232.0 +theme_override_fonts/font = ExtResource("2_g2els") +theme_override_font_sizes/font_size = 25 +text = "cassets:" diff --git a/scenes/puzzles/phonephreak.tscn b/scenes/puzzles/phonephreak.tscn index 40a003f..6377a10 100644 --- a/scenes/puzzles/phonephreak.tscn +++ b/scenes/puzzles/phonephreak.tscn @@ -5,33 +5,38 @@ [ext_resource type="Texture2D" uid="uid://hbkkhhlechol" path="res://assets/sprites/phonephreak.png" id="3_ba2os"] [node name="Phonephreak" type="Node2D" unique_id=1830177910] +position = Vector2(0, 1) script = ExtResource("1_knn0u") [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="." unique_id=519900134] +[node name="Phonephreak" type="Sprite2D" parent="." unique_id=1607325509] +position = Vector2(262, 339.5) +scale = Vector2(2.17, 2.17) +texture = ExtResource("3_ba2os") + [node name="Button0" type="Button" parent="." unique_id=1619377723] -offset_left = 568.0 -offset_top = 494.0 -offset_right = 613.0 -offset_bottom = 541.0 +offset_left = 590.0 +offset_top = 495.50003 +offset_right = 635.0 +offset_bottom = 542.5 flat = true [node name="Label" type="Label" parent="Button0" unique_id=1004291322] layout_mode = 0 -offset_right = 44.0 -offset_bottom = 51.0 +offset_left = 2.0 +offset_top = 2.0 +offset_right = 46.0 +offset_bottom = 53.0 theme_override_fonts/font = ExtResource("2_bg4gc") theme_override_font_sizes/font_size = 50 text = "0" [node name="ColorRect" type="ColorRect" parent="Button0" unique_id=582830561] layout_mode = 0 -offset_right = 43.0 -offset_bottom = 47.0 +offset_left = 6.0 +offset_top = 3.0 +offset_right = 49.0 +offset_bottom = 50.0 mouse_filter = 2 color = Color(1, 1, 1, 0) - -[node name="Phonephreak" type="Sprite2D" parent="." unique_id=1607325509] -position = Vector2(253, 328) -scale = Vector2(2.17, 2.17) -texture = ExtResource("3_ba2os") diff --git a/scenes/test_scene.tscn b/scenes/test_scene.tscn index fe24dab..2c10eb5 100644 --- a/scenes/test_scene.tscn +++ b/scenes/test_scene.tscn @@ -3,6 +3,7 @@ [ext_resource type="PackedScene" uid="uid://cmtdq6tedv1mm" path="res://scenes/player.tscn" id="1_g7g4h"] [ext_resource type="Script" uid="uid://v7bcqfwryutg" path="res://scripts/test_scene.gd" id="1_j8ivh"] [ext_resource type="PackedScene" uid="uid://dxx6mxv6x5yws" path="res://scenes/enemy.tscn" id="2_j8ivh"] +[ext_resource type="PackedScene" uid="uid://c17txy4vh4wka" path="res://scenes/casset.tscn" id="4_7ddre"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_aqe1g"] size = Vector2(1116.25, 73) @@ -28,4 +29,7 @@ position = Vector2(561.125, 569) shape = SubResource("RectangleShape2D_aqe1g") [node name="enemy" parent="." unique_id=1471932521 instance=ExtResource("2_j8ivh")] -position = Vector2(695, 334) +position = Vector2(380, 334) + +[node name="casset" parent="." unique_id=1213318639 instance=ExtResource("4_7ddre")] +position = Vector2(1018, 456) diff --git a/scripts/UltimatePlatformerController.gd b/scripts/UltimatePlatformerController.gd index a3f91d6..14a870f 100644 --- a/scripts/UltimatePlatformerController.gd +++ b/scripts/UltimatePlatformerController.gd @@ -324,16 +324,20 @@ func _process(_delta): var dir: bool = 1 func _physics_process(delta): + if GloblaData.doing_puzzle == true: + $".".global_position = $"../Marker2D2".global_position + $Label.text = str(int(GloblaData.cassets)) if Input.is_action_pressed("right"): dir = 1 if Input.is_action_pressed("left"): dir = 0 - if Input.is_action_just_pressed("fire"): - var instance = projectile.instantiate() - if !dir: - instance.speed = -instance.speed - instance.position = $Marker2D.global_position - GloblaData.test_level.add_child(instance) + if GloblaData.doing_puzzle == false: + if Input.is_action_just_pressed("fire"): + var instance = projectile.instantiate() + if !dir: + instance.speed = -instance.speed + instance.position = $Marker2D.global_position + GloblaData.level_1.add_child(instance) if GloblaData.death_counter == 0: get_tree().quit() if GloblaData.death_counter == 2: @@ -363,53 +367,53 @@ func _physics_process(delta): #INFO Left and Right Movement - - if rightHold and leftHold and movementInputMonitoring: - if !instantStop: - _decelerate(delta, false) - else: - velocity.x = -0.1 - elif rightHold and movementInputMonitoring.x: - if velocity.x > maxSpeed or instantAccel: - velocity.x = maxSpeed - else: - velocity.x += acceleration * delta - if velocity.x < 0: + if GloblaData.doing_puzzle == false: + if rightHold and leftHold and movementInputMonitoring: if !instantStop: _decelerate(delta, false) else: velocity.x = -0.1 - elif leftHold and movementInputMonitoring.y: - if velocity.x < -maxSpeed or instantAccel: - velocity.x = -maxSpeed - else: - velocity.x -= acceleration * delta + elif rightHold and movementInputMonitoring.x: + if velocity.x > maxSpeed or instantAccel: + velocity.x = maxSpeed + else: + velocity.x += acceleration * delta + if velocity.x < 0: + if !instantStop: + _decelerate(delta, false) + else: + velocity.x = -0.1 + elif leftHold and movementInputMonitoring.y: + if velocity.x < -maxSpeed or instantAccel: + velocity.x = -maxSpeed + else: + velocity.x -= acceleration * delta + if velocity.x > 0: + if !instantStop: + _decelerate(delta, false) + else: + velocity.x = 0.1 + if velocity.x > 0: + wasMovingR = true + elif velocity.x < 0: + wasMovingR = false + + if rightTap: + wasPressingR = true + if leftTap: + wasPressingR = false + + if runningModifier and !runHold: + maxSpeed = maxSpeedLock / 2 + elif is_on_floor(): + maxSpeed = maxSpeedLock + + if !(leftHold or rightHold): if !instantStop: _decelerate(delta, false) else: - velocity.x = 0.1 - - if velocity.x > 0: - wasMovingR = true - elif velocity.x < 0: - wasMovingR = false - - if rightTap: - wasPressingR = true - if leftTap: - wasPressingR = false - - if runningModifier and !runHold: - maxSpeed = maxSpeedLock / 2 - elif is_on_floor(): - maxSpeed = maxSpeedLock - - if !(leftHold or rightHold): - if !instantStop: - _decelerate(delta, false) - else: - velocity.x = 0 + velocity.x = 0 #INFO Crouching if crouch: @@ -451,81 +455,82 @@ func _physics_process(delta): pass #INFO Jump and Gravity - if velocity.y > 0: - appliedGravity = gravityScale * descendingGravityFactor - else: - appliedGravity = gravityScale - - if is_on_wall() and !groundPounding: - appliedTerminalVelocity = terminalVelocity / wallSliding - if wallLatching and ((wallLatchingModifer and latchHold) or !wallLatchingModifer): - appliedGravity = 0 - - if velocity.y < 0: - velocity.y += 50 - if velocity.y > 0: - velocity.y = 0 - - if wallLatchingModifer and latchHold and movementInputMonitoring == Vector2(true, true): - velocity.x = 0 - - elif wallSliding != 1 and velocity.y > 0: - appliedGravity = appliedGravity / wallSliding - elif !is_on_wall() and !groundPounding: - appliedTerminalVelocity = terminalVelocity - - if gravityActive: - if velocity.y < appliedTerminalVelocity: - velocity.y += appliedGravity - elif velocity.y > appliedTerminalVelocity: - velocity.y = appliedTerminalVelocity + if GloblaData.doing_puzzle == false: + if velocity.y > 0: + appliedGravity = gravityScale * descendingGravityFactor + else: + appliedGravity = gravityScale - if shortHopAkaVariableJumpHeight and jumpRelease and velocity.y < 0: - velocity.y = velocity.y / jumpVariable - - if jumps == 1: - if !is_on_floor() and !is_on_wall(): - if coyoteTime > 0: - coyoteActive = true - _coyoteTime() + if is_on_wall() and !groundPounding: + appliedTerminalVelocity = terminalVelocity / wallSliding + if wallLatching and ((wallLatchingModifer and latchHold) or !wallLatchingModifer): + appliedGravity = 0 - if jumpTap and !is_on_wall(): - if coyoteActive: - coyoteActive = false - _jump() - if jumpBuffering > 0: - jumpWasPressed = true - _bufferJump() - elif jumpBuffering == 0 and coyoteTime == 0 and is_on_floor(): - _jump() - elif jumpTap and is_on_wall() and !is_on_floor(): - if wallJump and !latched: - _wallJump() - elif wallJump and latched: - _wallJump() - elif jumpTap and is_on_floor(): - _jump() + if velocity.y < 0: + velocity.y += 50 + if velocity.y > 0: + velocity.y = 0 + + if wallLatchingModifer and latchHold and movementInputMonitoring == Vector2(true, true): + velocity.x = 0 + + elif wallSliding != 1 and velocity.y > 0: + appliedGravity = appliedGravity / wallSliding + elif !is_on_wall() and !groundPounding: + appliedTerminalVelocity = terminalVelocity + + if gravityActive: + if velocity.y < appliedTerminalVelocity: + velocity.y += appliedGravity + elif velocity.y > appliedTerminalVelocity: + velocity.y = appliedTerminalVelocity - if is_on_floor(): - jumpCount = jumps - if coyoteTime > 0: - coyoteActive = true - else: - coyoteActive = false - if jumpWasPressed: + if shortHopAkaVariableJumpHeight and jumpRelease and velocity.y < 0: + velocity.y = velocity.y / jumpVariable + + if jumps == 1: + if !is_on_floor() and !is_on_wall(): + if coyoteTime > 0: + coyoteActive = true + _coyoteTime() + + if jumpTap and !is_on_wall(): + if coyoteActive: + coyoteActive = false + _jump() + if jumpBuffering > 0: + jumpWasPressed = true + _bufferJump() + elif jumpBuffering == 0 and coyoteTime == 0 and is_on_floor(): + _jump() + elif jumpTap and is_on_wall() and !is_on_floor(): + if wallJump and !latched: + _wallJump() + elif wallJump and latched: + _wallJump() + elif jumpTap and is_on_floor(): _jump() + + if is_on_floor(): + jumpCount = jumps + if coyoteTime > 0: + coyoteActive = true + else: + coyoteActive = false + if jumpWasPressed: + _jump() - elif jumps > 1: - if is_on_floor(): - jumpCount = jumps - if jumpTap and is_on_wall() and wallJump: - _wallJump() - elif jumpTap and jumpCount > 0: - velocity.y = -jumpMagnitude - jumpCount = jumpCount - 1 - _endGroundPound() - - + elif jumps > 1: + if is_on_floor(): + jumpCount = jumps + if jumpTap and is_on_wall() and wallJump: + _wallJump() + elif jumpTap and jumpCount > 0: + velocity.y = -jumpMagnitude + jumpCount = jumpCount - 1 + _endGroundPound() + + #INFO dashing if is_on_floor(): dashCount = dashes -- 2.54.0