Skip to content

Commit

Permalink
level complete: fix fade in effect
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Feb 14, 2024
1 parent 7ec2eeb commit 00a1f5c
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 87 deletions.
Binary file modified game/assets/i18n/UltimateTossi18n.de.translation
Binary file not shown.
Binary file modified game/assets/i18n/UltimateTossi18n.en.translation
Binary file not shown.
Binary file modified game/assets/i18n/UltimateTossi18n.es.translation
Binary file not shown.
Binary file modified game/assets/i18n/UltimateTossi18n.it.translation
Binary file not shown.
9 changes: 5 additions & 4 deletions game/src/actors/bin/Bin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ extends StaticBody

signal win

onready var animation_player:AnimationPlayer = $AnimationPlayer
func _ready():
$AnimationPlayer.play("Size")
animation_player.play("Size")

func _on_BallDetector_body_entered(body) -> void:
if body.is_in_group("ball"):
Expand All @@ -17,9 +18,9 @@ func _on_Timer_timeout() -> void:
func fade_in() -> void:
# to match arrow animation
if Global.current_level > 1:
$AnimationPlayer.play("FadeIn")
yield($AnimationPlayer,"animation_finished")
$AnimationPlayer.play("Size")
animation_player.play("FadeIn")
yield(animation_player,"animation_finished")
animation_player.play("Size")

func hide() -> void:
visible = false
Expand Down
4 changes: 3 additions & 1 deletion game/src/fade-effect/FadeEffect.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

extends Tween

const DURATON:float = 0.2
const DURATON:float = 0.3

export var node_path:NodePath
export var node_path2:NodePath
Expand Down Expand Up @@ -32,11 +32,13 @@ func _ready() -> void:

func fade_in() -> void:
if node:
node.modulate = Color(1, 1, 1, 0)
interpolate_property(node, "modulate",
Color(1, 1, 1, 0), Color(1, 1, 1, 1), DURATON,
Tween.TRANS_LINEAR, Tween.EASE_IN)
start()
if node2:
node2.modulate = Color(1, 1, 1, 0)
interpolate_property(node2, "modulate",
Color(1, 1, 1, 0), Color(1, 1, 1, 1), DURATON,
Tween.TRANS_LINEAR, Tween.EASE_IN)
Expand Down
6 changes: 3 additions & 3 deletions game/src/levels/base-level/LevelBase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ func on_star2_hit() -> void:


func _on_Bin_win() -> void:
AudioMachine.hit(true)
if has_node("Tutorial"):
tutorial.fade_out()
level_complete.game_over()
level_complete.show()
AudioMachine.hit(true)
Global.save_data()


Expand Down Expand Up @@ -130,14 +130,14 @@ func _on_LevelComplete_replay() -> void:
func _on_LevelComplete_menu() -> void:
level_complete.reset_stars()
ball.reset_position()
main.show()
AudioMachine.reset()
star1.show_star()
star2.show_star()

if portals:
portals.reset()

main.show()
level_complete.hide()

func _camera_shake() -> void:
var start_position:Vector3 = camera.translation
Expand Down
10 changes: 6 additions & 4 deletions game/src/levels/base-level/LevelBase.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 61.1004, 0 )

[node name="Main" parent="UI" instance=ExtResource( 3 )]

[node name="Shop" parent="UI" instance=ExtResource( 10 )]
[node name="LevelComplete" parent="UI" instance=ExtResource( 6 )]
visible = false

[node name="LevelComplete" parent="UI" instance=ExtResource( 6 )]
[node name="Shop" parent="UI" instance=ExtResource( 10 )]
visible = false

[node name="Info" parent="UI" instance=ExtResource( 11 )]
Expand Down Expand Up @@ -210,12 +210,14 @@ script = ExtResource( 15 )
[connection signal="info" from="UI/Main" to="." method="_on_Main_info"]
[connection signal="levels" from="UI/Main" to="." method="_on_Main_levels"]
[connection signal="play" from="UI/Main" to="." method="_on_Main_play"]
[connection signal="help" from="UI/LevelComplete" to="." method="_on_LevelComplete_help"]
[connection signal="levels" from="UI/LevelComplete" to="." method="_on_LevelComplete_levels"]
[connection signal="menu" from="UI/LevelComplete" to="." method="_on_LevelComplete_menu"]
[connection signal="replay" from="UI/LevelComplete" to="." method="_on_LevelComplete_replay"]
[connection signal="back" from="UI/Shop" to="." method="_on_Shop_back"]
[connection signal="next" from="UI/Shop" to="." method="_on_Shop_next"]
[connection signal="prev" from="UI/Shop" to="." method="_on_Shop_prev"]
[connection signal="select" from="UI/Shop" to="." method="_on_Shop_select"]
[connection signal="menu" from="UI/LevelComplete" to="." method="_on_LevelComplete_menu"]
[connection signal="replay" from="UI/LevelComplete" to="." method="_on_LevelComplete_replay"]
[connection signal="back" from="UI/Info" to="." method="_on_Info_back"]
[connection signal="back" from="UI/LevelSelect" to="." method="_on_LevelSelect_back"]
[connection signal="back" from="UI/Help" to="." method="_on_Help_back"]
Expand Down
12 changes: 9 additions & 3 deletions game/src/screens/level-complete/LevelComplete.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ signal menu
signal levels
signal help

onready var animation_player:AnimationPlayer = $AnimationPlayer
onready var level_label:Label = $VBoxContainer/Level
onready var next_level_button:Button = $VBoxContainer/Buttons/NextLevel



var stars:int = 1

# to unlock next level without clicking on next level
Expand All @@ -30,24 +36,24 @@ func reset_stars() -> void:


func game_over() -> void:
$VBoxContainer/Level.text = str(Global.current_level)
level_label.text = str(Global.current_level)
Global.set_level_stars(stars)

if Global.unlock_next_level():
Global.current_level += 1
first_time_complete = true

if Global.current_level >= Global.LEVELS:
$VBoxContainer/Buttons/NextLevel.hide()
next_level_button.hide()

get_tree().paused = true
animation_player.play("FadeIn")


func _on_Menu_pressed() -> void:
AudioMachine.click()
if first_time_complete:
Global.current_level -= 1
hide()
emit_signal("menu")


Expand Down
148 changes: 122 additions & 26 deletions game/src/screens/level-complete/LevelComplete.tscn
Original file line number Diff line number Diff line change
@@ -1,12 +1,104 @@
[gd_scene load_steps=5 format=2]
[gd_scene load_steps=7 format=2]

[ext_resource path="res://theme.tres" type="Theme" id=1]
[ext_resource path="res://src/screens/level-complete/LevelComplete.gd" type="Script" id=2]
[ext_resource path="res://assets/star.png" type="Texture" id=3]
[ext_resource path="res://src/fade-effect/FadeEffect.tscn" type="PackedScene" id=4]

[sub_resource type="Animation" id=1]
resource_name = "FadeIn"
length = 1.4
tracks/0/type = "value"
tracks/0/path = NodePath("VBoxContainer/Stars/Star3:rect_scale")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.8, 1.1, 1.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0.01, 0.01 ), Vector2( 1.2, 1.2 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("VBoxContainer/Stars/Star2:rect_scale")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.6, 1.1, 1.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0.01, 0.01 ), Vector2( 1.41, 1.4 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("VBoxContainer/Stars/Star1:rect_scale")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.4, 1.1, 1.3 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ Vector2( 0.01, 0.01 ), Vector2( 1.6, 1.6 ), Vector2( 1, 1 ), Vector2( 1, 1 ) ]
}

[sub_resource type="Animation" id=2]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("VBoxContainer/Stars/Star1:rect_scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("VBoxContainer/Stars/Star2:rect_scale")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("VBoxContainer/Stars/Star3:rect_scale")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ Vector2( 1, 1 ) ]
}

[node name="LevelComplete" type="Control"]
pause_mode = 2
process_priority = 3
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
Expand All @@ -20,32 +112,32 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -237.5
margin_top = -497.5
margin_right = 237.5
margin_bottom = 417.5
margin_left = -287.0
margin_top = -521.0
margin_right = 287.0
margin_bottom = 409.0
alignment = 1

[node name="Level" type="Label" parent="VBoxContainer"]
margin_top = 65.0
margin_right = 475.0
margin_bottom = 183.0
margin_top = 73.0
margin_right = 574.0
margin_bottom = 191.0
rect_pivot_offset = Vector2( 237, 59 )
text = "12"
align = 1

[node name="Stars" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 207.0
margin_right = 475.0
margin_bottom = 407.0
margin_top = 215.0
margin_right = 574.0
margin_bottom = 415.0
rect_min_size = Vector2( 0, 200 )
alignment = 1

[node name="Star1" type="TextureRect" parent="VBoxContainer/Stars"]
self_modulate = Color( 0.988235, 0.898039, 0.152941, 1 )
margin_right = 155.0
margin_right = 188.0
margin_bottom = 200.0
rect_pivot_offset = Vector2( 50, 50 )
rect_pivot_offset = Vector2( 77, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 3 )
Expand All @@ -56,10 +148,10 @@ __meta__ = {

[node name="Star2" type="TextureRect" parent="VBoxContainer/Stars"]
self_modulate = Color( 0.984314, 0.956863, 0.745098, 1 )
margin_left = 159.0
margin_right = 315.0
margin_left = 192.0
margin_right = 381.0
margin_bottom = 200.0
rect_pivot_offset = Vector2( 50, 50 )
rect_pivot_offset = Vector2( 78, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 3 )
Expand All @@ -70,10 +162,10 @@ __meta__ = {

[node name="Star3" type="TextureRect" parent="VBoxContainer/Stars"]
self_modulate = Color( 0.984314, 0.956863, 0.745098, 1 )
margin_left = 319.0
margin_right = 475.0
margin_left = 385.0
margin_right = 574.0
margin_bottom = 200.0
rect_pivot_offset = Vector2( 50, 50 )
rect_pivot_offset = Vector2( 78, 100 )
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource( 3 )
Expand All @@ -83,20 +175,20 @@ __meta__ = {
}

[node name="Buttons" type="VBoxContainer" parent="VBoxContainer"]
margin_top = 431.0
margin_right = 475.0
margin_bottom = 849.0
margin_top = 439.0
margin_right = 574.0
margin_bottom = 857.0
rect_pivot_offset = Vector2( 194, 215 )
custom_constants/separation = 20

[node name="NextLevel" type="Button" parent="VBoxContainer/Buttons"]
margin_right = 475.0
margin_right = 574.0
margin_bottom = 126.0
text = "NEXT"

[node name="Replay" type="Button" parent="VBoxContainer/Buttons"]
margin_top = 146.0
margin_right = 475.0
margin_right = 574.0
margin_bottom = 272.0
text = "REPLAY"

Expand All @@ -110,16 +202,20 @@ text = "LEVELS"
[node name="Help" type="Button" parent="VBoxContainer/Buttons"]
visible = false
margin_top = 292.0
margin_right = 475.0
margin_right = 574.0
margin_bottom = 418.0
text = "HELP"

[node name="Menu" type="Button" parent="VBoxContainer/Buttons"]
margin_top = 292.0
margin_right = 475.0
margin_right = 574.0
margin_bottom = 418.0
text = "MENU"

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/FadeIn = SubResource( 1 )
anims/RESET = SubResource( 2 )

[connection signal="pressed" from="VBoxContainer/Buttons/NextLevel" to="." method="_on_NextLevel_pressed"]
[connection signal="pressed" from="VBoxContainer/Buttons/Replay" to="." method="_on_Replay_pressed"]
[connection signal="pressed" from="VBoxContainer/Buttons/Levels" to="." method="_on_Levels_pressed"]
Expand Down
Loading

0 comments on commit 00a1f5c

Please sign in to comment.