Skip to content

Commit

Permalink
shop: refactor shop
Browse files Browse the repository at this point in the history
  • Loading branch information
dulvui committed Jan 30, 2024
1 parent ade8ee3 commit d99d3a4
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 77 deletions.
4 changes: 2 additions & 2 deletions game/assets/i18n/UltimateTossi18n.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ NEXT_LEVEL,level {amount},level {amount},level {amount},level {amount}
REPLAY,replay,nochmal,rigioca,repetir
MENU,menu,menü,menu,menu
BUY,buy,kaufen,compra,compra
FOLLOW,follow me,folge mir,seguimi,sigame
MORE_GAMES,other games,andere spiele,altri giochi,otros juegos
FOLLOW,follow,folge,seguimi,sigame
MORE_GAMES,games,spiele,giochi,juegos
NEXT,next,nächstes,prossimo,próximo
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.
3 changes: 1 addition & 2 deletions game/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ translations=PoolStringArray( "res://assets/i18n/UltimateTossi18n.de.translation

[physics]

common/physics_fps=240
common/physics_fps=120
2d/default_gravity_vector=Vector2( 0, 9.8 )
3d/default_gravity_vector=Vector3( 0, -9.8, 0 )
common/physics_interpolation=true

[rendering]

Expand Down
1 change: 1 addition & 0 deletions game/src/actors/objects/base-object/BaseObject.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func fade_in() -> void:
yield(animation_player,"animation_finished")
if delay > 0:
yield(get_tree().create_timer(delay/10.0), "timeout")

if animation_player.has_animation("Act"):
animation_player.play("Act")

Expand Down
6 changes: 2 additions & 4 deletions game/src/levels/base-level/LevelBase.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func _ready() -> void:
get_tree().paused = true
main.animation_player.play("FirstFadeIn")
animation_player.play("FadeIn")
animation_player.play("TopbarFadeIn")
else:
get_tree().paused = false
else:
Expand Down Expand Up @@ -78,8 +77,6 @@ func _on_Bin_win() -> void:


func _on_Shop_back() -> void:
shop.animation_player.play("FadeOut")
yield(shop.animation_player,"animation_finished")
shop.hide()

main.show()
Expand All @@ -92,7 +89,6 @@ func _on_Shop_select() -> void:
# menu animations
shop.hide()
animation_player.play("GoToMenu")
main.play()

# ball setup
var pos:Transform = ball.initial_position
Expand All @@ -106,6 +102,8 @@ func _on_Shop_select() -> void:
ball.initial_position = pos
ball.teletransport_to_inital()
_connect_ball_signals()

get_tree().paused = false


func _on_Shop_prev() -> void:
Expand Down
26 changes: 5 additions & 21 deletions game/src/levels/base-level/LevelBase.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=2]
[gd_scene load_steps=23 format=2]

[ext_resource path="res://src/levels/base-level/LevelBase.gd" type="Script" id=1]
[ext_resource path="res://src/levels/base-level/base-3d/Base3D.tscn" type="PackedScene" id=2]
Expand Down Expand Up @@ -106,22 +106,6 @@ tracks/1/keys = {
"values": [ Color( 1, 1, 1, 1 ) ]
}

[sub_resource type="Animation" id=19]
resource_name = "TopbarFadeIn"
length = 1.2
tracks/0/type = "value"
tracks/0/path = NodePath("UI/Topbar:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5, 1.2 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
}

[sub_resource type="PhysicsMaterial" id=15]
friction = 0.5
bounce = 0.9
Expand All @@ -136,7 +120,6 @@ anims/GoToMenu = SubResource( 2 )
anims/GoToShop = SubResource( 3 )
anims/Idle = SubResource( 20 )
anims/RESET = SubResource( 18 )
anims/TopbarFadeIn = SubResource( 19 )

[node name="Tween" type="Tween" parent="."]

Expand All @@ -160,7 +143,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -5.06394, 9.04416, 0.575264 )
[node name="Tutorial" parent="." instance=ExtResource( 13 )]

[node name="Shop3D" parent="." instance=ExtResource( 16 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 58.6909, 0 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 61.1004, 0 )

[node name="UI" type="CanvasLayer" parent="."]

Expand Down Expand Up @@ -197,16 +180,17 @@ rect_scale = Vector2( 1, 1 )
[node name="VSeparator" type="VSeparator" parent="UI/Topbar"]
modulate = Color( 1, 1, 1, 0 )
margin_left = 108.0
margin_right = 588.0
margin_right = 552.0
margin_bottom = 126.0
size_flags_horizontal = 3

[node name="Pause" type="Button" parent="UI/Topbar"]
pause_mode = 2
modulate = Color( 1, 1, 1, 0.705882 )
margin_left = 592.0
margin_left = 556.0
margin_right = 656.0
margin_bottom = 126.0
rect_min_size = Vector2( 100, 0 )
icon = ExtResource( 14 )
icon_align = 1
script = ExtResource( 15 )
Expand Down
4 changes: 0 additions & 4 deletions game/src/screens/main/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ func _on_Play_pressed() -> void:
AudioMachine.click()
emit_signal("play")

func play() -> void:
get_tree().paused = false
animation_player.play("FadeOut")

func _on_Sfx_pressed() -> void:
AudioMachine.click()
Global.toggle_sfx()
Expand Down
30 changes: 18 additions & 12 deletions game/src/screens/main/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ anims/RESET = SubResource( 12 )
modulate = Color( 1, 1, 1, 0 )
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 11.0
margin_top = 19.0
margin_right = 11.0
margin_bottom = 19.0
color = Color( 0.105882, 0.105882, 0.231373, 1 )

[node name="Buttons" type="VBoxContainer" parent="."]
Expand All @@ -74,10 +78,9 @@ anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -286.0
margin_top = -425.0
margin_top = -500.5
margin_right = 286.0
margin_bottom = 587.0
rect_pivot_offset = Vector2( 188, 0 )
margin_bottom = 500.5
alignment = 1

[node name="Level" type="HBoxContainer" parent="Buttons"]
Expand Down Expand Up @@ -123,29 +126,32 @@ text = " > "
modulate = Color( 1, 1, 1, 0 )
margin_top = 150.0
margin_right = 572.0
margin_bottom = 516.0
margin_bottom = 337.0
size_flags_vertical = 3

[node name="Play" type="Button" parent="Buttons"]
margin_top = 540.0
margin_top = 361.0
margin_right = 572.0
margin_bottom = 666.0
margin_bottom = 548.0
size_flags_horizontal = 5
size_flags_vertical = 7
text = "PLAY"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="HSeparator2" type="HSeparator" parent="Buttons"]
modulate = Color( 1, 1, 1, 0 )
margin_top = 690.0
margin_top = 572.0
margin_right = 572.0
margin_bottom = 770.0
margin_bottom = 759.0
rect_min_size = Vector2( 0, 80 )
size_flags_vertical = 3

[node name="Settings" type="HBoxContainer" parent="Buttons"]
margin_top = 794.0
margin_top = 783.0
margin_right = 572.0
margin_bottom = 914.0
margin_bottom = 903.0
custom_constants/separation = 18
alignment = 1
__meta__ = {
Expand Down Expand Up @@ -257,9 +263,9 @@ texture_normal = ExtResource( 6 )

[node name="SimonDalvai" type="LinkButton" parent="Buttons"]
margin_left = 93.0
margin_top = 938.0
margin_top = 927.0
margin_right = 479.0
margin_bottom = 1012.0
margin_bottom = 1001.0
focus_mode = 2
size_flags_horizontal = 4
custom_fonts/font = SubResource( 13 )
Expand Down
20 changes: 12 additions & 8 deletions game/src/screens/shop/Shop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ signal prev
signal back
signal select

onready var select_button:Button = $VBoxContainer/Buttons/Select
onready var star:TextureRect = $VBoxContainer/Buttons/Select/Star


func _ready() -> void:
_set_select_label()

Expand Down Expand Up @@ -51,7 +55,7 @@ func _on_Select_pressed() -> void:
BallMachine.select()
_set_select_label()
if result == 1:
$Select.text = "PLAY"
select_button.text = "PLAY"
# special cases like follow, more games etc...
if ball["price"] is String:
if ball["price"] == tr("FOLLOW"):
Expand All @@ -65,22 +69,22 @@ func _on_Select_pressed() -> void:
else:
OS.shell_open("https://play.google.com/store/apps/dev?id=7836644900810357474&hl=en")

emit_signal("select")
emit_signal("select")


func _set_select_label() -> void:
var ball = BallMachine.get_current_ball_info()
if Global.unlocked_balls.has(ball["id"]):
$VBoxContainer/Select.text = "PLAY"
$VBoxContainer/Select/Star.hide()
select_button.text = "PLAY"
star.hide()

else:
if ball["price"] is String:
$VBoxContainer/Select.text = str(ball["price"])
$VBoxContainer/Select/Star.hide()
select_button.text = str(ball["price"])
star.hide()
else:
$VBoxContainer/Select.text = str(ball["price"])
$VBoxContainer/Select/Star.show()
select_button.text = str(ball["price"])
star.show()

var ball_instance = ball["real"].instance()
set_values(ball_instance)
55 changes: 31 additions & 24 deletions game/src/screens/shop/Shop.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ anchor_top = 0.568
anchor_right = 0.5
anchor_bottom = 0.568
margin_left = -321.0
margin_top = -471.54
margin_top = -365.04
margin_right = 321.0
margin_bottom = 441.46
margin_bottom = 390.96

[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 642.0
Expand Down Expand Up @@ -57,13 +57,13 @@ text = " > "
modulate = Color( 1, 1, 1, 0 )
margin_top = 150.0
margin_right = 642.0
margin_bottom = 325.0
margin_bottom = 318.0
size_flags_vertical = 3

[node name="Bounce" type="ProgressBar" parent="VBoxContainer"]
margin_top = 349.0
margin_top = 342.0
margin_right = 642.0
margin_bottom = 469.0
margin_bottom = 462.0
rect_min_size = Vector2( 0, 120 )
size_flags_vertical = 1
min_value = 0.6
Expand All @@ -85,9 +85,9 @@ __meta__ = {
}

[node name="Mass" type="ProgressBar" parent="VBoxContainer"]
margin_top = 493.0
margin_top = 486.0
margin_right = 642.0
margin_bottom = 613.0
margin_bottom = 606.0
rect_min_size = Vector2( 0, 120 )
size_flags_vertical = 1
min_value = 4.0
Expand All @@ -106,21 +106,37 @@ text = "MASS"
align = 1
valign = 1

[node name="Select" type="Button" parent="VBoxContainer"]
margin_top = 637.0
[node name="Buttons" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 630.0
margin_right = 642.0
margin_bottom = 763.0
margin_bottom = 756.0
custom_constants/separation = 40

[node name="Back" type="Button" parent="VBoxContainer/Buttons"]
margin_right = 289.0
margin_bottom = 126.0
size_flags_horizontal = 3
text = "BACK"
__meta__ = {
"_edit_use_anchors_": true
}

[node name="Select" type="Button" parent="VBoxContainer/Buttons"]
margin_left = 329.0
margin_right = 642.0
margin_bottom = 126.0
size_flags_horizontal = 3
text = "SELECT"
__meta__ = {
"_edit_use_anchors_": true
}

[node name="Star" type="TextureRect" parent="VBoxContainer/Select"]
[node name="Star" type="TextureRect" parent="VBoxContainer/Buttons/Select"]
visible = false
modulate = Color( 1, 0.968627, 0.227451, 1 )
anchor_left = 0.768
anchor_left = 0.690275
anchor_top = 0.048
anchor_right = 0.924
anchor_right = 1.01025
anchor_bottom = 0.841
margin_left = -0.0559998
margin_top = -0.0479999
Expand All @@ -131,16 +147,7 @@ __meta__ = {
"_edit_use_anchors_": true
}

[node name="Back" type="Button" parent="VBoxContainer"]
margin_top = 787.0
margin_right = 642.0
margin_bottom = 913.0
text = "BACK"
__meta__ = {
"_edit_use_anchors_": true
}

[connection signal="pressed" from="VBoxContainer/HBoxContainer/Prev" to="." method="_on_Prev_pressed"]
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Next" to="." method="_on_Next_pressed"]
[connection signal="pressed" from="VBoxContainer/Select" to="." method="_on_Select_pressed"]
[connection signal="pressed" from="VBoxContainer/Back" to="." method="_on_Back_pressed"]
[connection signal="pressed" from="VBoxContainer/Buttons/Back" to="." method="_on_Back_pressed"]
[connection signal="pressed" from="VBoxContainer/Buttons/Select" to="." method="_on_Select_pressed"]

0 comments on commit d99d3a4

Please sign in to comment.