Update level name and refactor player rotation handling; add rotation target variable
This commit is contained in:
@@ -167,3 +167,5 @@ common/physics_interpolation=true
|
||||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
2d/snap/snap_2d_transforms_to_pixel=true
|
||||
2d/snap/snap_2d_vertices_to_pixel=true
|
||||
|
@@ -508,7 +508,7 @@ ease = 2
|
||||
|
||||
[sub_resource type="Resource" id="Resource_75pfo"]
|
||||
script = ExtResource("25_4k8fq")
|
||||
level_name = "World - 1"
|
||||
level_name = "Village - 1"
|
||||
metadata/_custom_type_script = "uid://cp68km8bykymb"
|
||||
|
||||
[node name="World" type="Node2D"]
|
||||
@@ -565,9 +565,10 @@ position = Vector2(3710, 1)
|
||||
[node name="Enemy7" parent="Enemies" instance=ExtResource("7_qgddg")]
|
||||
position = Vector2(3945, 33)
|
||||
|
||||
[node name="Brick Player" parent="." instance=ExtResource("4_hetw8")]
|
||||
[node name="Brick Player" parent="." node_paths=PackedStringArray("rotation_target") instance=ExtResource("4_hetw8")]
|
||||
z_index = 5
|
||||
position = Vector2(903, -118)
|
||||
rotation_target = NodePath("Root/Base")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
|
@@ -17,6 +17,7 @@ var previous_velocity: Vector2 = Vector2.ZERO
|
||||
@export var coyote_mode: bool = false
|
||||
@export var was_last_floor: bool = false
|
||||
@export var jump_sfx: AudioStreamPlayer2D
|
||||
@export var rotation_target: Node2D
|
||||
|
||||
@onready var jump_velocity: float = ((2.0 * jump_height) / jump_time_to_peak) * -1.0
|
||||
@onready var jump_gravity: float = ((-2.0 * jump_height) / (jump_time_to_peak * jump_time_to_peak)) * -1.0
|
||||
@@ -30,11 +31,11 @@ func _ready() -> void:
|
||||
|
||||
func _process(_delta):
|
||||
if velocity.x > 0.0:
|
||||
root.rotation = deg_to_rad(-10)
|
||||
rotation_target.rotation = deg_to_rad(-10)
|
||||
elif velocity.x < 0.0:
|
||||
root.rotation = deg_to_rad(10)
|
||||
rotation_target.rotation = deg_to_rad(10)
|
||||
else:
|
||||
root.rotation = 0
|
||||
rotation_target.rotation = 0
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
|
Reference in New Issue
Block a user