Skip to content
Snippets Groups Projects
Commit 84677b46 authored by Fabian Keßler's avatar Fabian Keßler
Browse files

Fix pinguin target offset

parent 3fcfbdf0
No related branches found
No related tags found
No related merge requests found
...@@ -126,7 +126,7 @@ func _on_LockTimer_timeout() -> void: ...@@ -126,7 +126,7 @@ func _on_LockTimer_timeout() -> void:
# Set the target rotation so the orca faces the penguin. # Set the target rotation so the orca faces the penguin.
target_rotation = (lock_target_pos - global_position).angle() + deg_to_rad(90) target_rotation = (lock_target_pos - global_position).angle() + deg_to_rad(90)
# Slices the first ice floe that the given unit–length line (with one end at the penguin) cuts. # Slices the first ice floe that the given unit–lengath line (with one end at the penguin) cuts.
func slice_floes(slice_start: Vector2, slice_end: Vector2) -> void: func slice_floes(slice_start: Vector2, slice_end: Vector2) -> void:
for child in Globals.ice_floes: for child in Globals.ice_floes:
if child == target_penguin.get_parent(): # Only cut the slice with the target if child == target_penguin.get_parent(): # Only cut the slice with the target
......
...@@ -4,10 +4,8 @@ ...@@ -4,10 +4,8 @@
[ext_resource type="Texture2D" uid="uid://d3caevtq02wc3" path="res://NPC/orca/orca.png" id="2_jmt3e"] [ext_resource type="Texture2D" uid="uid://d3caevtq02wc3" path="res://NPC/orca/orca.png" id="2_jmt3e"]
[ext_resource type="Texture2D" uid="uid://ct80ox3ffphif" path="res://icon.svg" id="3_113yi"] [ext_resource type="Texture2D" uid="uid://ct80ox3ffphif" path="res://icon.svg" id="3_113yi"]
[sub_resource type="Animation" id="Animation_113yi"] [sub_resource type="Animation" id="Animation_1gx0u"]
resource_name = "blink" length = 0.001
length = 0.2
loop_mode = 1
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
...@@ -15,14 +13,16 @@ tracks/0/path = NodePath(".:modulate") ...@@ -15,14 +13,16 @@ tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 1, "update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0.375), Color(1, 1, 1, 1)] "values": [Color(1, 1, 1, 1)]
} }
[sub_resource type="Animation" id="Animation_1gx0u"] [sub_resource type="Animation" id="Animation_113yi"]
length = 0.001 resource_name = "blink"
length = 0.2
loop_mode = 1
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
...@@ -30,10 +30,10 @@ tracks/0/path = NodePath(".:modulate") ...@@ -30,10 +30,10 @@ tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 1,
"values": [Color(1, 1, 1, 1)] "values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0.375), Color(1, 1, 1, 1)]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_f5vvu"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_f5vvu"]
......
...@@ -61,7 +61,7 @@ func set_target(t: Vector2): ...@@ -61,7 +61,7 @@ func set_target(t: Vector2):
target = t target = t
func _process(delta: float) -> void: func _process(delta: float) -> void:
var dir = (target - position).normalized() var dir = (target - global_position).normalized()
var bump_dir = Vector2.ZERO var bump_dir = Vector2.ZERO
self.rotation = -get_parent().rotation self.rotation = -get_parent().rotation
......
...@@ -104,10 +104,11 @@ func _input(event: InputEvent) -> void: ...@@ -104,10 +104,11 @@ func _input(event: InputEvent) -> void:
if Input.is_action_pressed("Fish") and FishScene != null and canPlace: if Input.is_action_pressed("Fish") and FishScene != null and canPlace:
Fish = FishScene.instantiate() Fish = FishScene.instantiate()
Fish.position = position Fish.global_position = global_position
add_sibling(Fish) add_sibling(Fish)
for pengu in Globals.pengu_group: for pengu in Globals.pengu_group.penguins:
pengu.set_target(Fish.position) if is_instance_valid(pengu) and not pengu.is_queued_for_deletion():
pengu.set_target(Fish.global_position)
canPlace = false canPlace = false
$FishDespawnTimer.start(2) $FishDespawnTimer.start(2)
$FishCooldownTimer.start(4) $FishCooldownTimer.start(4)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment