From 13394479bdd87dafe64c5a93223015e0942bab4d Mon Sep 17 00:00:00 2001 From: Yadciel Date: Mon, 28 Nov 2022 12:58:12 +0100 Subject: [PATCH] SomeUpdate Slots can update, other scaling --- Main Scenes/Game.tscn | 16 +++++++++++++--- Objects/Entity.tscn | 2 +- Objects/Overlay.tscn | 14 +++++++------- Objects/Panzer.tscn | 11 +++-------- Objects/Slot.gd | 18 ++++++++++++++---- Objects/Spawner.gd | 9 ++++++--- Objects/item.tscn | 2 ++ project.godot | 3 ++- 8 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Main Scenes/Game.tscn b/Main Scenes/Game.tscn index aff27fe..cb3a727 100644 --- a/Main Scenes/Game.tscn +++ b/Main Scenes/Game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://retrowave.png" type="Texture" id=1] [ext_resource path="res://Objects/Overlay.tscn" type="PackedScene" id=2] @@ -22,7 +22,10 @@ region_rect = Rect2( 0, 0, 8, 8 ) font_data = ExtResource( 6 ) [sub_resource type="RectangleShape2D" id=6] -extents = Vector2( 288, 40 ) +extents = Vector2( 288, 64 ) + +[sub_resource type="RectangleShape2D" id=7] +extents = Vector2( 287, 88 ) [node name="Game" type="Node2D"] script = ExtResource( 3 ) @@ -165,9 +168,16 @@ margin_bottom = 0.0 [node name="Bullet_Grave" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Bullet_Grave"] -position = Vector2( 288, -40 ) +position = Vector2( 288, -16 ) shape = SubResource( 6 ) +[node name="CheckSpawnSpeed" type="Area2D" parent="."] +position = Vector2( 288, 145 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="CheckSpawnSpeed"] +position = Vector2( 0, 42 ) +shape = SubResource( 7 ) + [connection signal="pressed" from="VBoxContainer/ButtonGrid/Speed" to="." method="_on_Speed_pressed"] [connection signal="pressed" from="VBoxContainer/ButtonGrid/Panzer" to="." method="_on_Panzer_pressed"] [connection signal="area_entered" from="Bullet_Grave" to="." method="_on_Bullet_Grave_area_entered"] diff --git a/Objects/Entity.tscn b/Objects/Entity.tscn index 32fe340..77b079c 100644 --- a/Objects/Entity.tscn +++ b/Objects/Entity.tscn @@ -69,7 +69,7 @@ func _on_Area2D_area_entered(area): extents = Vector2( 4, 4 ) [sub_resource type="DynamicFont" id=3] -size = 12 +size = 11 font_data = ExtResource( 2 ) [node name="Entity" type="KinematicBody2D" groups=["Enemy"]] diff --git a/Objects/Overlay.tscn b/Objects/Overlay.tscn index c3d28ac..1178d1f 100644 --- a/Objects/Overlay.tscn +++ b/Objects/Overlay.tscn @@ -20,10 +20,10 @@ func _process(delta): if ($CanvasLayer/Score.text as int % 100) == 0: emit_signal(\"score\") if pBar.value == pBar.max_value: - var value = 0.5 + var value = 5 emit_signal(\"full_bar\", value) pBar.value = 0 - pBar.max_value *= 2 + pBar.max_value *= 1.2 pass func on_Death_listed(value): @@ -56,16 +56,16 @@ anchor_right = 0.5 margin_left = -144.0 margin_top = 48.0 margin_right = 48.0 -margin_bottom = 62.0 +margin_bottom = 67.0 rect_scale = Vector2( 1.5, 1.5 ) custom_fonts/font = SubResource( 2 ) max_value = 16.0 [node name="Score" type="Label" parent="CanvasLayer"] -margin_left = 256.0 -margin_top = 16.0 -margin_right = 296.0 -margin_bottom = 39.0 +margin_left = 288.0 +margin_top = 14.0 +margin_right = 328.0 +margin_bottom = 42.0 grow_horizontal = 2 grow_vertical = 2 custom_fonts/font = SubResource( 3 ) diff --git a/Objects/Panzer.tscn b/Objects/Panzer.tscn index 773da43..21a245d 100644 --- a/Objects/Panzer.tscn +++ b/Objects/Panzer.tscn @@ -10,7 +10,7 @@ const bulletPath = preload(\"res:///Objects/Bullet.tscn\") var speed = 3 onready var old_slot = null onready var GameNode -var PanzerType = null +var PanzerType = 0 var hit_power = 2 func _ready(): @@ -39,19 +39,14 @@ func shoot(): func set_shoot_speed(value): if speed != 0.5: speed -= value - print(speed) pass func PanzerType(PanzerType): - if PanzerType == null: - pass if PanzerType == 1: - pass - if PanzerType == 2: $Sprite.region_rect = Rect2(0, 64, 16, 16) - if PanzerType == 3: + if PanzerType == 2: $Sprite.region_rect = Rect2(0, 80, 16, 16) - if PanzerType == 4: + if PanzerType == 3: $Sprite.modulate = Color(0.875, 0, 1) $Sprite.region_rect = Rect2(0, 80, 16, 16) diff --git a/Objects/Slot.gd b/Objects/Slot.gd index e80716b..7ca7591 100644 --- a/Objects/Slot.gd +++ b/Objects/Slot.gd @@ -2,9 +2,11 @@ extends Panel var PanzerType = preload("res://Objects/Panzer.tscn") var Panzer = null +var level = 0 var start_panzer = 0 func _process(delta): + check_level() if start_panzer > 0: if randi() % 2 == 0: Panzer = PanzerType.instance() @@ -19,6 +21,11 @@ func pickFromSlot(): Panzer = null func putIntoSlot(new_panzer): + if level != 0 and new_panzer.old_slot == null: + if new_panzer.PanzerType != null: + new_panzer.PanzerType += 1 + else: + new_panzer.PanzerType = 2 Panzer = new_panzer Panzer.position = Vector2(64, 64) var GameNode = find_parent("Game") @@ -27,10 +34,7 @@ func putIntoSlot(new_panzer): func upgradePanzerInSlot(): Panzer.hit_power *= 2 - if Panzer.PanzerType != null: - Panzer.PanzerType += 1 - else: - Panzer.PanzerType = 2 + Panzer.PanzerType += 1 pass func _set_start_panzer(value): @@ -43,3 +47,9 @@ func _on_slotshape_area_entered(area): if GameNode.holding_item != null: GameNode.hover = self pass # Replace with function body. + + +func check_level(): + if level == 1: + modulate = Color(1, 0.984375, 0) + pass diff --git a/Objects/Spawner.gd b/Objects/Spawner.gd index c3c5c91..e3e249e 100644 --- a/Objects/Spawner.gd +++ b/Objects/Spawner.gd @@ -6,7 +6,8 @@ var enemy = null var item = null var e_speed = 50 var e_life = 2 -var spawn_rate = 4 +var spawn_rate = 3 +var spawn_speed = 3.5 var rng = RandomNumberGenerator.new() var Time = 0 @@ -23,7 +24,7 @@ func _ready(): func _process(delta): Time += delta - if Time > 3.5: + if Time > spawn_speed: rng.randomize() if rng.randi_range(0, spawn_rate) == 0: if rng.randi_range(0, 10) != 0: @@ -42,6 +43,8 @@ func _process(delta): func set_spawn_values(value): e_speed += value e_life *= 2 - if (spawn_rate > 2): + if (spawn_rate > 1): spawn_rate -= 1 + elif spawn_speed > 1.5: + spawn_speed -= 0.1 pass diff --git a/Objects/item.tscn b/Objects/item.tscn index 63abcfc..19f6f72 100644 --- a/Objects/item.tscn +++ b/Objects/item.tscn @@ -41,6 +41,8 @@ func _on_Area2D_area_entered(area): emit_signal(\"on_Death\", value) emit_signal(\"badget\", value) queue_free() + if area.is_in_group(\"Border\"): + queue_free() pass # Replace with function body. " diff --git a/project.godot b/project.godot index 1367d78..c182c68 100644 --- a/project.godot +++ b/project.godot @@ -81,9 +81,10 @@ MobileAds="*res://addons/admob/src/singletons/MobileAds.gd" window/size/width=576 window/size/height=1200 +window/size/test_width=576 +window/size/test_height=900 window/handheld/orientation="portrait" window/stretch/mode="2d" -window/stretch/aspect="keep_height" [editor_plugins]