feat: parallax and more environment
This commit is contained in:
@ -9,6 +9,7 @@ size = Vector2(630, 340)
|
||||
script = ExtResource("1_f5lvx")
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
@ -16,6 +17,8 @@ collision_mask = 2
|
||||
shape = SubResource("RectangleShape2D_7mycd")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position_smoothing_enabled = true
|
||||
position_smoothing_speed = 30.0
|
||||
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="Area2D" to="." method="_on_body_exited"]
|
||||
|
21
main.gd
21
main.gd
@ -9,14 +9,26 @@ var active_camera: SuperCamera
|
||||
|
||||
@onready var opening_cutscene: AnimationPlayer = $OpeningCutscene
|
||||
|
||||
@onready var background_far: TileMapLayer = $BackgroundFar
|
||||
@onready var background_middle: TileMapLayer = $BackgroundMiddle
|
||||
@onready var background_close: TileMapLayer = $BackgroundClose
|
||||
@onready var foreground_far: TileMapLayer = $ForegroundFar
|
||||
|
||||
@export_group("Parallax")
|
||||
@export var parallax_far = 0.1
|
||||
@export var parallax_middle = 0.3
|
||||
@export var parallax_close = 0.5
|
||||
@export var foreground = 0.8
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
for child in get_children():
|
||||
if is_instance_of(child, SuperCamera):
|
||||
child.became_active.connect(on_camera_became_active)
|
||||
|
||||
opening_cutscene.play("opening_cutscene")
|
||||
opening_fade_to_black.visible = true
|
||||
#opening_cutscene.play("opening_cutscene")
|
||||
#opening_fade_to_black.visible = true
|
||||
|
||||
func on_camera_became_active(camera: SuperCamera):
|
||||
active_camera = camera
|
||||
@ -28,3 +40,8 @@ func _process(delta: float) -> void:
|
||||
bubbles_back.global_position.x = active_camera.global_position.x
|
||||
bubbles_interior.global_position.x = active_camera.global_position.x
|
||||
|
||||
background_far.global_position.x = active_camera.global_position.x * parallax_far
|
||||
background_middle.global_position.x = active_camera.global_position.x * parallax_middle
|
||||
background_close.global_position.x = active_camera.global_position.x * parallax_close
|
||||
foreground_far.global_position.x = active_camera.global_position.x * foreground
|
||||
|
||||
|
@ -16,7 +16,7 @@ var gravity_modifier = 1
|
||||
|
||||
var animated_sprites = []
|
||||
|
||||
var is_in_cutscene = true
|
||||
var is_in_cutscene = false # back to true on build
|
||||
var current_animation = "idle"
|
||||
|
||||
func play_anim():
|
||||
|
Reference in New Issue
Block a user