Added catch up. Added level 2
This commit is contained in:
@@ -3,8 +3,12 @@ extends Node2D
|
||||
|
||||
|
||||
const CORRUPTION_DAMAGE = 10.0
|
||||
const ADDITIONAL_SCROLL_OFFSET = 500.0
|
||||
const MAX_DISTANCE_TO_CORRUPTION = 320.0
|
||||
|
||||
|
||||
@export var is_player_running_on_start := true
|
||||
@export var background_offset := 0.0
|
||||
@export var initial_corruption_x := -400.0
|
||||
@export var corruption_speed := 200.0
|
||||
@export var desctruction_offset := 100.0
|
||||
@@ -28,14 +32,20 @@ var _corruption_x: float
|
||||
|
||||
@onready var camera : Camera2D = player.camera
|
||||
|
||||
@onready var parallax_1 : Parallax2D = $Background/Parallax1
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
parallax_1.scroll_offset.x = ADDITIONAL_SCROLL_OFFSET + background_offset
|
||||
|
||||
_corruption_x = initial_corruption_x
|
||||
pause_menu.hide()
|
||||
game_over_menu.hide()
|
||||
completion_menu.hide()
|
||||
|
||||
if is_player_running_on_start:
|
||||
player.velocity.x = player.move_max_speed_normal
|
||||
|
||||
health_bar.initialize(player.MAX_HEALTH, player.MAX_HEALTH)
|
||||
player.health_changed.connect(health_bar.set_current_value)
|
||||
|
||||
@@ -63,7 +73,10 @@ func _physics_process(delta: float) -> void:
|
||||
if corruption_timer.is_stopped():
|
||||
corruption_timer.start()
|
||||
else:
|
||||
MAX_DISTANCE_TO_CORRUPTION
|
||||
corruption_timer.stop()
|
||||
if player.position.x - _corruption_x > MAX_DISTANCE_TO_CORRUPTION:
|
||||
_corruption_x = player.position.x - MAX_DISTANCE_TO_CORRUPTION
|
||||
|
||||
if player.position.y > 0.0:
|
||||
SoundManager.play_sfx_stream(SoundManager.sfx_stream_fall, player.global_position)
|
||||
|
||||
@@ -1895,8 +1895,9 @@ script = ExtResource("1_o2mui")
|
||||
|
||||
[node name="Parallax1" type="Parallax2D" parent="Background" unique_id=1102720638]
|
||||
scroll_scale = Vector2(0.01, 0.01)
|
||||
scroll_offset = Vector2(-602, 180)
|
||||
scroll_offset = Vector2(500, 180)
|
||||
repeat_size = Vector2(900, 0)
|
||||
repeat_times = 2
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Background/Parallax1" unique_id=1313622890]
|
||||
texture = ExtResource("2_3fw0b")
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,7 +3,8 @@
|
||||
[ext_resource type="Script" uid="uid://cm1lme51ido64" path="res://game/managers/level_manager.gd" id="1_te7jw"]
|
||||
[ext_resource type="PackedScene" uid="uid://deto1j12jm5rf" path="res://game/levels/level_1.tscn" id="2_dp0cj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuig5x5fd47hs" path="res://game/levels/test_level.tscn" id="2_ow2rn"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0rwlgmvvo637" path="res://game/levels/level_2.tscn" id="3_r84xe"]
|
||||
|
||||
[node name="LevelManager" type="Node" unique_id=1657502743]
|
||||
script = ExtResource("1_te7jw")
|
||||
levels = Array[PackedScene]([ExtResource("2_dp0cj"), ExtResource("2_ow2rn")])
|
||||
levels = Array[PackedScene]([ExtResource("2_dp0cj"), ExtResource("3_r84xe"), ExtResource("2_ow2rn")])
|
||||
|
||||
Reference in New Issue
Block a user