diff --git a/coin.gd b/coin.gd index 2c32765..28f8ad6 100644 --- a/coin.gd +++ b/coin.gd @@ -9,7 +9,6 @@ func _process(delta: float) -> void: pass func on_contact(body: Node2D) -> void: - print(body) $AudioStreamPlayer2D.play() visible = false %Player2D.coins += 1 diff --git a/hidden_coin.gd b/hidden_coin.gd index 022ac28..c4c2f01 100644 --- a/hidden_coin.gd +++ b/hidden_coin.gd @@ -9,7 +9,6 @@ func _process(delta: float) -> void: pass func on_contact(body: Node2D) -> void: - print(body) $AudioStreamPlayer2D.play() visible = false %Player2D.coins += 1 diff --git a/hidden_spike.gd b/hidden_spike.gd index b2dfba2..f1d144a 100644 --- a/hidden_spike.gd +++ b/hidden_spike.gd @@ -11,4 +11,3 @@ func on_contact(body: Node2D) -> void: print("SLASH KILL") %Player2D/Jetpack/DeathSound.play() %Player2D.on_death(false,%Player2D.position) - print(body) diff --git a/hidden_teleporter.gd b/hidden_teleporter.gd index 5b98ff4..7ac5ebb 100644 --- a/hidden_teleporter.gd +++ b/hidden_teleporter.gd @@ -12,7 +12,6 @@ func _ready() -> void: add_to_group("Hidden") func check_for_pair() -> String: - print(paired_teleporter) return paired_teleporter func disable(): diff --git a/horizontal_moving_block.gd b/horizontal_moving_block.gd index c5070d6..99ca09a 100644 --- a/horizontal_moving_block.gd +++ b/horizontal_moving_block.gd @@ -1,11 +1,21 @@ extends RigidBody2D var max_distance = position + Vector2(1,0) +var move_speed = 0.01 func _ready() -> void: - print("START POSITION: " + str(position)) - pass + add_to_group("MovingPlatform") func _process(delta: float) -> void: - print("NEW POSITION :" + str(position)) - position.x = move_toward(position.x, max_distance.x, 1) + print(max_distance) + position.x = move_toward(position.x, max_distance.x, move_speed) + +func on_enter(body) -> void: + print("ON MOVING PLATFORM") + if %Player2D.is_on_floor(): + %Player2D.is_on_moving_platform = true + %Player2D.platform_speed = move_speed + +func on_leave(body) -> void: + print("OFF MOVING PLATFORM") + %Player2D.is_on_moving_platform = false diff --git a/horizontal_moving_block.tscn b/horizontal_moving_block.tscn index 5924443..30b1ee8 100644 --- a/horizontal_moving_block.tscn +++ b/horizontal_moving_block.tscn @@ -4,7 +4,10 @@ [ext_resource type="Texture2D" uid="uid://blbaaqyrt8dtk" path="res://art/block/block.png" id="1_m1vtb"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_f3sb7"] -size = Vector2(16, 14) +size = Vector2(32, 16) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_3uo2v"] +size = Vector2(38, 23) [node name="Block" type="RigidBody2D" unique_id=1409784601] gravity_scale = 0.0 @@ -12,8 +15,26 @@ freeze = true script = ExtResource("1_3uo2v") [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1866755047] +position = Vector2(0, -2) shape = SubResource("RectangleShape2D_f3sb7") [node name="Sprite2D" type="Sprite2D" parent="." unique_id=1680278216] texture_filter = 1 +position = Vector2(-8, -2) texture = ExtResource("1_m1vtb") + +[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=549053101] +texture_filter = 1 +position = Vector2(8, -2) +texture = ExtResource("1_m1vtb") + +[node name="Area2D" type="Area2D" parent="." unique_id=1910272404] + +[node name="ShapeCast2D" type="CollisionShape2D" parent="Area2D" unique_id=934904308] +position = Vector2(0, -3.5) +shape = SubResource("RectangleShape2D_3uo2v") + +[connection signal="body_entered" from="." to="." method="on_enter"] +[connection signal="body_exited" from="." to="." method="on_leave"] +[connection signal="body_entered" from="Area2D" to="." method="on_enter"] +[connection signal="body_exited" from="Area2D" to="." method="on_leave"] diff --git a/long_floor_spike.gd b/long_floor_spike.gd index ca85932..70441a2 100644 --- a/long_floor_spike.gd +++ b/long_floor_spike.gd @@ -11,4 +11,3 @@ func on_contact(body: Node2D) -> void: print("SLASH KILL") %Player2D/Jetpack/DeathSound.play() %Player2D.on_death(false,%Player2D.position) - print(body) diff --git a/pickup.gd b/pickup.gd index 4aa34f2..12ecfe2 100644 --- a/pickup.gd +++ b/pickup.gd @@ -12,7 +12,6 @@ func _process(delta: float) -> void: pass func on_contact(body: Node2D) -> void: - print(body) $AudioStreamPlayer2D.play(0) visible = false picked_up.emit() diff --git a/player_2d.gd b/player_2d.gd index c036650..8162268 100644 --- a/player_2d.gd +++ b/player_2d.gd @@ -11,6 +11,9 @@ const JUMP_VELOCITY = -410.0 const DASH_LENGTH = 0.2 const BACKGROUND_COLOR = Color(Color.ORANGE.r + 0.80,Color.ORANGE.g + 0.20,Color.ORANGE.b - 0.10) +var is_on_moving_platform = false +var platform_speed = 0 + var death_cooldown = 0.0 var fall_timer = 0.0 var teleport_cooldown = 0 @@ -93,8 +96,6 @@ func spawn_ghost(ghost_position): var ghost = preload("res://ghost.tscn") ghost = ghost.instantiate() get_parent().add_child(ghost) - print(ghost) - print(ghost.position) ghost.position = ghost_position func on_death(instant = false, player_position = position): @@ -122,16 +123,16 @@ func on_death(instant = false, player_position = position): func _process(delta: float) -> void: if Input.is_key_pressed(Key.KEY_W) or Input.is_key_pressed(Key.KEY_A) or Input.is_key_pressed(Key.KEY_S) or Input.is_key_pressed(Key.KEY_D): - print("KEYBOARD") controller_ui = false elif Input.get_action_strength("move_horizontal") > 0: - print("CONTROLLER") controller_ui = true if Input.is_action_just_released("restart") or (Input.is_action_pressed("controller_restart_left") and Input.is_action_pressed("controller_restart_right")): get_tree().reload_current_scene() if is_on_floor(): + if is_on_moving_platform: + %Player2D.position.x += platform_speed last_ground_point = global_position #spawn_point = last_ground_point diff --git a/spike.gd b/spike.gd index ca85932..70441a2 100644 --- a/spike.gd +++ b/spike.gd @@ -11,4 +11,3 @@ func on_contact(body: Node2D) -> void: print("SLASH KILL") %Player2D/Jetpack/DeathSound.play() %Player2D.on_death(false,%Player2D.position) - print(body) diff --git a/teleporter.gd b/teleporter.gd index 11de2d5..010e63d 100644 --- a/teleporter.gd +++ b/teleporter.gd @@ -11,7 +11,6 @@ func _ready() -> void: add_to_group("TELEPORTERS") func check_for_pair() -> String: - #print(paired_teleporter) return paired_teleporter func disable(): diff --git a/warp_shader.gd b/warp_shader.gd index c2ed4ad..c99c3f6 100644 --- a/warp_shader.gd +++ b/warp_shader.gd @@ -10,7 +10,5 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: - #print(DisplayServer.window_get_size().x) - #print(DisplayServer.window_get_size().y) mesh.size.x = DisplayServer.window_get_size().x * 4 mesh.size.y = DisplayServer.window_get_size().y * 4 diff --git a/world.tscn b/world.tscn index ab7ade5..7346057 100644 --- a/world.tscn +++ b/world.tscn @@ -41,7 +41,7 @@ scale = Vector2(1, 1.0155824) [node name="Player2D" parent="." unique_id=889851478 instance=ExtResource("1_aqk2v")] unique_name_in_owner = true -position = Vector2(-4838, 217.6091) +position = Vector2(-4833.9995, 356.4457) rotation = 0.0005533503 safe_margin = 0.08 @@ -51,7 +51,13 @@ position = Vector2(-4673, 390.9087) [node name="LongerBlock" parent="StartingArea" unique_id=1619185575 instance=ExtResource("6_dwbse")] position = Vector2(-17, -17.72377) -[node name="LongerBlock2" parent="StartingArea" unique_id=426800863 instance=ExtResource("6_dwbse")] +[node name="LongerBlock3" parent="StartingArea" unique_id=426800863 instance=ExtResource("6_dwbse")] +position = Vector2(-353, -17.72383) + +[node name="LongerBlock4" parent="StartingArea" unique_id=470273291 instance=ExtResource("6_dwbse")] +position = Vector2(-354, -128.99002) + +[node name="LongerBlock2" parent="StartingArea" unique_id=806639319 instance=ExtResource("6_dwbse")] position = Vector2(650, -17.72377) [node name="LongerBlock5" parent="StartingArea" unique_id=1844119708 instance=ExtResource("6_dwbse")] @@ -940,4 +946,10 @@ sign_text = "TAKE A LEAP" [node name="Block20" parent="." unique_id=1489084043 instance=ExtResource("34_w44yn")] position = Vector2(-4824, 299.3356) +[node name="VerticalLongBlock9" parent="." unique_id=1737292270 instance=ExtResource("4_pkg7o")] +position = Vector2(-4866, 311.15155) + +[node name="VerticalLongBlock10" parent="." unique_id=952105658 instance=ExtResource("4_pkg7o")] +position = Vector2(-5189, 322.96738) + [connection signal="toggled" from="CanvasLayer/MusicButton" to="CanvasLayer/MusicButton" method="_on_toggled"]