diff --git a/Export/Game.apk b/Export/Game.apk index 405617b..1fc9a1a 100644 Binary files a/Export/Game.apk and b/Export/Game.apk differ diff --git a/Export/Game.apk.idsig b/Export/Game.apk.idsig index 996f933..8583a2c 100644 Binary files a/Export/Game.apk.idsig and b/Export/Game.apk.idsig differ diff --git a/Main Scenes/Game.gd b/Main Scenes/Game.gd index ddbeac5..35ecf57 100644 --- a/Main Scenes/Game.gd +++ b/Main Scenes/Game.gd @@ -5,6 +5,7 @@ const SlotClass = preload("res:///Objects/Slot.gd") var Panzer_Temp = preload("res://Objects/Panzer.tscn") onready var game_slots = $VBoxContainer/PanzerSlots onready var overlay_node = find_node("Overlay") +var score_file = "user://highscore_2048Shooter.save" var holding_item = null var buy_panzer_left = 0 var life = 100 @@ -30,6 +31,7 @@ func _ready(): func _process(delta): if $Panel/Area2D/LifeBar.value == 0: + save_score() get_tree().change_scene("res://Main Scenes/GameOver.tscn") func slot_gui_input(event: InputEvent, slot: SlotClass): @@ -146,7 +148,24 @@ func drag_drop_handle(hover): var temp2 = holding_item hover.pickFromSlot() hover.putIntoSlot(holding_item) - print(holding_item.old_slot) temp2.old_slot.putIntoSlot(temp) holding_item = null - + elif holding_item.old_slot == null: + var temp = hover.Panzer + var temp2 = holding_item + hover.pickFromSlot() + hover.putIntoSlot(holding_item) + holding_item = temp + holding_item.global_position = get_global_mouse_position() + holding_item.old_slot = null + +func save_score(): + var highscoreNode = find_node("Score") + var f = File.new() + if f.file_exists(score_file): + f.open(score_file, File.READ) + if (f.get_var() as int) > 0: + f.close() + f.open(score_file,File.WRITE) + f.store_var(highscoreNode.text) + f.close() diff --git a/Main Scenes/MainMenu.tscn b/Main Scenes/MainMenu.tscn index 3cf37b2..2637767 100644 --- a/Main Scenes/MainMenu.tscn +++ b/Main Scenes/MainMenu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=1] [ext_resource path="res://retrowave.png" type="Texture" id=2] @@ -6,7 +6,7 @@ [sub_resource type="GDScript" id=2] script/source = "extends Node2D - +var score_file = \"user://highscore_2048Shooter.save\" # Declare member variables here. Examples: # var a = 2 # var b = \"text\" @@ -14,6 +14,7 @@ script/source = "extends Node2D # Called when the node enters the scene tree for the first time. func _ready(): + load_score() pass # Replace with function body. @@ -25,12 +26,27 @@ func _ready(): func _on_Start_pressed(): get_tree().change_scene(\"res://Main Scenes/Game.tscn\") pass # Replace with function body. + + +func load_score(): + var f = File.new() + if f.file_exists(score_file): + $Control/Score.visible = true + f.open(score_file, File.READ) + $Control/Score.text = \"Score: \" + f.get_var() as String + f.close() + else: + $Control/Score.text = '0' " [sub_resource type="DynamicFont" id=1] font_data = ExtResource( 1 ) -[node name="Node2D" type="Node2D"] +[sub_resource type="DynamicFont" id=3] +size = 40 +font_data = ExtResource( 1 ) + +[node name="MainMenu" type="Node2D"] script = SubResource( 2 ) [node name="Background" type="Sprite" parent="."] @@ -54,9 +70,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -180.0 -margin_top = -12.0 +margin_top = 244.0 margin_right = 140.0 -margin_bottom = 140.0 +margin_bottom = 396.0 [node name="Button" type="Button" parent="Control/VBoxContainer"] margin_right = 320.0 @@ -65,4 +81,12 @@ rect_min_size = Vector2( 0, 70 ) custom_fonts/font = SubResource( 1 ) text = "Start" +[node name="Score" type="Label" parent="Control"] +margin_left = -264.0 +margin_top = -424.0 +margin_right = -69.0 +margin_bottom = -368.0 +custom_fonts/font = SubResource( 3 ) +text = "Score: " + [connection signal="pressed" from="Control/VBoxContainer/Button" to="." method="_on_Start_pressed"] diff --git a/addons/admob/test/Example.tscn b/addons/admob/test/Example.tscn index b5e5133..c0cfcb6 100644 --- a/addons/admob/test/Example.tscn +++ b/addons/admob/test/Example.tscn @@ -103,14 +103,14 @@ __meta__ = { } [node name="Banner" type="HBoxContainer" parent="Background/TabContainer/AdFormats/VBoxContainer"] -margin_top = 46.0 -margin_right = 426.0 -margin_bottom = 66.0 +margin_top = 65.0 +margin_right = 408.0 +margin_bottom = 85.0 size_flags_vertical = 0 alignment = 1 [node name="EnableBanner" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer/Banner"] -margin_right = 211.0 +margin_right = 202.0 margin_bottom = 20.0 size_flags_horizontal = 3 disabled = true @@ -120,22 +120,22 @@ __meta__ = { } [node name="DisableBanner" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer/Banner"] -margin_left = 215.0 -margin_right = 426.0 +margin_left = 206.0 +margin_right = 408.0 margin_bottom = 20.0 size_flags_horizontal = 3 disabled = true text = "DISABLE BANNER" [node name="Banner2" type="HBoxContainer" parent="Background/TabContainer/AdFormats/VBoxContainer"] -margin_top = 70.0 -margin_right = 426.0 -margin_bottom = 90.0 +margin_top = 89.0 +margin_right = 408.0 +margin_bottom = 109.0 size_flags_vertical = 0 alignment = 1 [node name="ShowBanner" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer/Banner2"] -margin_right = 211.0 +margin_right = 202.0 margin_bottom = 20.0 size_flags_horizontal = 3 disabled = true @@ -145,31 +145,31 @@ __meta__ = { } [node name="HideBanner" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer/Banner2"] -margin_left = 215.0 -margin_right = 426.0 +margin_left = 206.0 +margin_right = 408.0 margin_bottom = 20.0 size_flags_horizontal = 3 disabled = true text = "HIDE BANNER" [node name="Interstitial" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer"] -margin_top = 94.0 -margin_right = 426.0 -margin_bottom = 114.0 +margin_top = 113.0 +margin_right = 408.0 +margin_bottom = 133.0 disabled = true text = "INTERSTITIAL" [node name="Rewarded" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer"] -margin_top = 118.0 -margin_right = 426.0 -margin_bottom = 138.0 +margin_top = 137.0 +margin_right = 408.0 +margin_bottom = 157.0 disabled = true text = "REWARDED" [node name="RewardedInterstitial" type="Button" parent="Background/TabContainer/AdFormats/VBoxContainer"] -margin_top = 142.0 -margin_right = 426.0 -margin_bottom = 162.0 +margin_top = 161.0 +margin_right = 408.0 +margin_bottom = 181.0 disabled = true text = "REWARDED INTERSTITIAL" diff --git a/project.godot b/project.godot index c182c68..100815e 100644 --- a/project.godot +++ b/project.godot @@ -18,7 +18,7 @@ config={ "size": "BANNER", "unit_ids": { "Android": { -"standard": "ca-app-pub-3940256099942544/6300978111" +"standard": "ca-app-pub-8587655649812919~8719438638" }, "iOS": { "standard": "ca-app-pub-3940256099942544/2934735716" @@ -33,12 +33,12 @@ config={ "general": { "is_enabled": true, "is_for_child_directed_treatment": false, -"max_ad_content_rating": "PG" +"max_ad_content_rating": "G" }, "interstitial": { "unit_ids": { "Android": { -"standard": "ca-app-pub-3940256099942544/1033173712" +"standard": "ca-app-pub-8587655649812919~8719438638" }, "iOS": { "standard": "ca-app-pub-3940256099942544/4411468910" @@ -48,7 +48,7 @@ config={ "rewarded": { "unit_ids": { "Android": { -"standard": "ca-app-pub-3940256099942544/5224354917" +"standard": "ca-app-pub-8587655649812919~8719438638" }, "iOS": { "standard": "ca-app-pub-3940256099942544/1712485313" @@ -58,7 +58,7 @@ config={ "rewarded_interstitial": { "unit_ids": { "Android": { -"standard": "ca-app-pub-3940256099942544/5354046379" +"standard": "ca-app-pub-8587655649812919~8719438638" }, "iOS": { "standard": "ca-app-pub-3940256099942544/6978759866"