Rotate the bottles

This commit is contained in:
Marvin Dalheimer 2024-01-27 17:32:41 +01:00
parent 7460acf72d
commit 21b96bc687
Signed by: Rinma
GPG Key ID: 44CAD3A9F1679D8D
3 changed files with 24 additions and 13 deletions

View File

@ -7,25 +7,26 @@ var is_hidding: bool
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
tim_global_position = get_node("/root/IngameScene/Stage/Tim/ThrowPoint").global_position tim_global_position = get_node("/root/IngameScene/Stage/Tim/ThrowPoint").global_position
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
var t = create_tween() var t = create_tween().set_parallel()
t.tween_property(self, "global_position", tim_global_position, 3.0) t.tween_property(self, "global_position", tim_global_position, 3.0)
t.tween_callback(remove_bottle) t.tween_property(self, "rotation_degrees", rotation_degrees + 270, 3.0)
t.tween_callback(remove_bottle).set_delay(3.05)
func _on_bottle_area_entered(area): func _on_bottle_area_entered(area):
is_hidding = true is_hidding = true
func _on_bottle_area_exited(area): func _on_bottle_area_exited(area):
is_hidding = false is_hidding = false
func _on_growth_timer_timeout(): func _on_growth_timer_timeout():
var t = create_tween() var t = create_tween()
t.tween_property(self, "scale", self.scale + Vector2(0.01, 0.01), 0.02) t.tween_property(self, "scale", self.scale + Vector2(0.01, 0.01), 0.02)
func remove_bottle(): func remove_bottle():
if is_hidding: if is_hidding:
print("Ouch") print("Ouch")
queue_free() queue_free()

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://c5f5v1wtottyp"] [gd_scene load_steps=4 format=3 uid="uid://c5f5v1wtottyp"]
[ext_resource type="Script" path="res://scenes/objects/bottle.gd" id="1_87ktq"] [ext_resource type="Script" path="res://scenes/objects/bottle.gd" id="1_87ktq"]
[ext_resource type="Texture2D" uid="uid://bavsg3hu7pccy" path="res://sprites/room/bottle.svg" id="1_uea7l"] [ext_resource type="Texture2D" uid="uid://cow4dd0hlxrgr" path="res://sprites/room/bottle.svg" id="1_uea7l"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_p8qcj"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_p8qcj"]
radius = 22.4893 radius = 22.4893

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://cicyfp5xjvvu4"] [gd_scene load_steps=8 format=3 uid="uid://cicyfp5xjvvu4"]
[ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"] [ext_resource type="Script" path="res://scenes/Tim.gd" id="1_g3k2b"]
[ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"] [ext_resource type="Texture2D" uid="uid://kq63ictuirhc" path="res://sprites/tim_side.png" id="1_saxit"]
@ -8,6 +8,9 @@
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_3hx6l"] [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_3hx6l"]
size = Vector2(600, 200) size = Vector2(600, 200)
[sub_resource type="CircleShape2D" id="CircleShape2D_jfw8v"]
radius = 23.0217
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wmfel"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_wmfel"]
size = Vector2(250, 10000) size = Vector2(250, 10000)
@ -26,6 +29,13 @@ boundary = NodePath("../Boundary")
tim_sprite = NodePath("Sprite2D") tim_sprite = NodePath("Sprite2D")
transmitter_area = NodePath("Joke Transmitter/Area2D") transmitter_area = NodePath("Joke Transmitter/Area2D")
[node name="ThrowPoint" type="Area2D" parent="Tim"]
position = Vector2(0, -153)
[node name="CollisionShape2D" type="CollisionShape2D" parent="Tim/ThrowPoint"]
position = Vector2(0, 1)
shape = SubResource("CircleShape2D_jfw8v")
[node name="Sprite2D" type="Sprite2D" parent="Tim"] [node name="Sprite2D" type="Sprite2D" parent="Tim"]
z_index = 110 z_index = 110
position = Vector2(-12, -142) position = Vector2(-12, -142)