SomeUpdate

Slots can update, other scaling
This commit is contained in:
Yadciel 2022-11-28 12:58:12 +01:00
parent 044a36de7a
commit 13394479bd
8 changed files with 48 additions and 27 deletions

View File

@ -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://retrowave.png" type="Texture" id=1]
[ext_resource path="res://Objects/Overlay.tscn" type="PackedScene" id=2] [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 ) font_data = ExtResource( 6 )
[sub_resource type="RectangleShape2D" id=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"] [node name="Game" type="Node2D"]
script = ExtResource( 3 ) script = ExtResource( 3 )
@ -165,9 +168,16 @@ margin_bottom = 0.0
[node name="Bullet_Grave" type="Area2D" parent="."] [node name="Bullet_Grave" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Bullet_Grave"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Bullet_Grave"]
position = Vector2( 288, -40 ) position = Vector2( 288, -16 )
shape = SubResource( 6 ) 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/Speed" to="." method="_on_Speed_pressed"]
[connection signal="pressed" from="VBoxContainer/ButtonGrid/Panzer" to="." method="_on_Panzer_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"] [connection signal="area_entered" from="Bullet_Grave" to="." method="_on_Bullet_Grave_area_entered"]

View File

@ -69,7 +69,7 @@ func _on_Area2D_area_entered(area):
extents = Vector2( 4, 4 ) extents = Vector2( 4, 4 )
[sub_resource type="DynamicFont" id=3] [sub_resource type="DynamicFont" id=3]
size = 12 size = 11
font_data = ExtResource( 2 ) font_data = ExtResource( 2 )
[node name="Entity" type="KinematicBody2D" groups=["Enemy"]] [node name="Entity" type="KinematicBody2D" groups=["Enemy"]]

View File

@ -20,10 +20,10 @@ func _process(delta):
if ($CanvasLayer/Score.text as int % 100) == 0: if ($CanvasLayer/Score.text as int % 100) == 0:
emit_signal(\"score\") emit_signal(\"score\")
if pBar.value == pBar.max_value: if pBar.value == pBar.max_value:
var value = 0.5 var value = 5
emit_signal(\"full_bar\", value) emit_signal(\"full_bar\", value)
pBar.value = 0 pBar.value = 0
pBar.max_value *= 2 pBar.max_value *= 1.2
pass pass
func on_Death_listed(value): func on_Death_listed(value):
@ -56,16 +56,16 @@ anchor_right = 0.5
margin_left = -144.0 margin_left = -144.0
margin_top = 48.0 margin_top = 48.0
margin_right = 48.0 margin_right = 48.0
margin_bottom = 62.0 margin_bottom = 67.0
rect_scale = Vector2( 1.5, 1.5 ) rect_scale = Vector2( 1.5, 1.5 )
custom_fonts/font = SubResource( 2 ) custom_fonts/font = SubResource( 2 )
max_value = 16.0 max_value = 16.0
[node name="Score" type="Label" parent="CanvasLayer"] [node name="Score" type="Label" parent="CanvasLayer"]
margin_left = 256.0 margin_left = 288.0
margin_top = 16.0 margin_top = 14.0
margin_right = 296.0 margin_right = 328.0
margin_bottom = 39.0 margin_bottom = 42.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
custom_fonts/font = SubResource( 3 ) custom_fonts/font = SubResource( 3 )

View File

@ -10,7 +10,7 @@ const bulletPath = preload(\"res:///Objects/Bullet.tscn\")
var speed = 3 var speed = 3
onready var old_slot = null onready var old_slot = null
onready var GameNode onready var GameNode
var PanzerType = null var PanzerType = 0
var hit_power = 2 var hit_power = 2
func _ready(): func _ready():
@ -39,19 +39,14 @@ func shoot():
func set_shoot_speed(value): func set_shoot_speed(value):
if speed != 0.5: if speed != 0.5:
speed -= value speed -= value
print(speed)
pass pass
func PanzerType(PanzerType): func PanzerType(PanzerType):
if PanzerType == null:
pass
if PanzerType == 1: if PanzerType == 1:
pass
if PanzerType == 2:
$Sprite.region_rect = Rect2(0, 64, 16, 16) $Sprite.region_rect = Rect2(0, 64, 16, 16)
if PanzerType == 3: if PanzerType == 2:
$Sprite.region_rect = Rect2(0, 80, 16, 16) $Sprite.region_rect = Rect2(0, 80, 16, 16)
if PanzerType == 4: if PanzerType == 3:
$Sprite.modulate = Color(0.875, 0, 1) $Sprite.modulate = Color(0.875, 0, 1)
$Sprite.region_rect = Rect2(0, 80, 16, 16) $Sprite.region_rect = Rect2(0, 80, 16, 16)

View File

@ -2,9 +2,11 @@ extends Panel
var PanzerType = preload("res://Objects/Panzer.tscn") var PanzerType = preload("res://Objects/Panzer.tscn")
var Panzer = null var Panzer = null
var level = 0
var start_panzer = 0 var start_panzer = 0
func _process(delta): func _process(delta):
check_level()
if start_panzer > 0: if start_panzer > 0:
if randi() % 2 == 0: if randi() % 2 == 0:
Panzer = PanzerType.instance() Panzer = PanzerType.instance()
@ -19,6 +21,11 @@ func pickFromSlot():
Panzer = null Panzer = null
func putIntoSlot(new_panzer): 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 = new_panzer
Panzer.position = Vector2(64, 64) Panzer.position = Vector2(64, 64)
var GameNode = find_parent("Game") var GameNode = find_parent("Game")
@ -27,10 +34,7 @@ func putIntoSlot(new_panzer):
func upgradePanzerInSlot(): func upgradePanzerInSlot():
Panzer.hit_power *= 2 Panzer.hit_power *= 2
if Panzer.PanzerType != null:
Panzer.PanzerType += 1 Panzer.PanzerType += 1
else:
Panzer.PanzerType = 2
pass pass
func _set_start_panzer(value): func _set_start_panzer(value):
@ -43,3 +47,9 @@ func _on_slotshape_area_entered(area):
if GameNode.holding_item != null: if GameNode.holding_item != null:
GameNode.hover = self GameNode.hover = self
pass # Replace with function body. pass # Replace with function body.
func check_level():
if level == 1:
modulate = Color(1, 0.984375, 0)
pass

View File

@ -6,7 +6,8 @@ var enemy = null
var item = null var item = null
var e_speed = 50 var e_speed = 50
var e_life = 2 var e_life = 2
var spawn_rate = 4 var spawn_rate = 3
var spawn_speed = 3.5
var rng = RandomNumberGenerator.new() var rng = RandomNumberGenerator.new()
var Time = 0 var Time = 0
@ -23,7 +24,7 @@ func _ready():
func _process(delta): func _process(delta):
Time += delta Time += delta
if Time > 3.5: if Time > spawn_speed:
rng.randomize() rng.randomize()
if rng.randi_range(0, spawn_rate) == 0: if rng.randi_range(0, spawn_rate) == 0:
if rng.randi_range(0, 10) != 0: if rng.randi_range(0, 10) != 0:
@ -42,6 +43,8 @@ func _process(delta):
func set_spawn_values(value): func set_spawn_values(value):
e_speed += value e_speed += value
e_life *= 2 e_life *= 2
if (spawn_rate > 2): if (spawn_rate > 1):
spawn_rate -= 1 spawn_rate -= 1
elif spawn_speed > 1.5:
spawn_speed -= 0.1
pass pass

View File

@ -41,6 +41,8 @@ func _on_Area2D_area_entered(area):
emit_signal(\"on_Death\", value) emit_signal(\"on_Death\", value)
emit_signal(\"badget\", value) emit_signal(\"badget\", value)
queue_free() queue_free()
if area.is_in_group(\"Border\"):
queue_free()
pass # Replace with function body. pass # Replace with function body.
" "

View File

@ -81,9 +81,10 @@ MobileAds="*res://addons/admob/src/singletons/MobileAds.gd"
window/size/width=576 window/size/width=576
window/size/height=1200 window/size/height=1200
window/size/test_width=576
window/size/test_height=900
window/handheld/orientation="portrait" window/handheld/orientation="portrait"
window/stretch/mode="2d" window/stretch/mode="2d"
window/stretch/aspect="keep_height"
[editor_plugins] [editor_plugins]