mirror of
https://github.com/Yadciel1/2048-Shooter.git
synced 2024-12-25 14:27:03 +01:00
fix
This commit is contained in:
parent
46fbe6685b
commit
58f6f31446
10
Entity.tscn
10
Entity.tscn
@ -8,14 +8,17 @@ script/source = "extends KinematicBody2D
|
||||
|
||||
var velocity = Vector2(0,1)
|
||||
var speed = 50
|
||||
var life = 2
|
||||
|
||||
signal on_Death
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var text = randi() % 4
|
||||
var text = randi() % life as int
|
||||
$Label.text = (text+1) as String
|
||||
var Progressbars = get_tree().get_nodes_in_group(\"XP\")
|
||||
for Progressbar in Progressbars:
|
||||
self.connect(\"on_Death\",Progressbar, \"on_Death_listed\")
|
||||
Progressbar.connect(\"full_bar\", self, \"set_speed\")
|
||||
pass # Replace with function body.
|
||||
|
||||
@ -37,7 +40,10 @@ func _on_Area2D_area_entered(area):
|
||||
pass # Replace with function body.
|
||||
|
||||
func set_speed(value):
|
||||
speed += value
|
||||
var Spawner = get_tree().get_nodes_in_group(\"Spawner\")
|
||||
for Spawn in Spawner:
|
||||
Spawn.e_speed += value
|
||||
Spawn.e_life *= 1.2
|
||||
"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
|
12
Game.gd
12
Game.gd
@ -5,12 +5,16 @@ const SlotClass = preload("res://Slot.gd")
|
||||
var Panzer_Temp = preload("res://Panzer.tscn")
|
||||
onready var game_slots = $VBoxContainer/PanzerSlots
|
||||
var holding_item = null
|
||||
var buy_panzer_left = 0
|
||||
|
||||
signal speed_shoot
|
||||
|
||||
func _ready():
|
||||
for gam_slot in game_slots.get_children():
|
||||
gam_slot.connect("gui_input", self, "slot_gui_input", [gam_slot])
|
||||
var pBars = get_tree().get_nodes_in_group("XP")
|
||||
for pBar in pBars:
|
||||
pBar.connect("full_bar", self, "_enable_Panzer")
|
||||
|
||||
|
||||
func slot_gui_input(event: InputEvent, slot: SlotClass):
|
||||
@ -38,6 +42,9 @@ func _input(event):
|
||||
|
||||
|
||||
func _on_Panzer_pressed():
|
||||
buy_panzer_left -= 1
|
||||
if buy_panzer_left == 0:
|
||||
$VBoxContainer/ButtonGrid/Panzer.disabled = true
|
||||
if holding_item == null:
|
||||
var Panzer = null
|
||||
Panzer = Panzer_Temp.instance()
|
||||
@ -50,4 +57,9 @@ func _on_Panzer_pressed():
|
||||
func _on_Speed_pressed():
|
||||
var value = 0.5
|
||||
emit_signal("speed_shoot", value)
|
||||
$VBoxContainer/ButtonGrid/Speed.disabled = true
|
||||
pass # Replace with function body.
|
||||
|
||||
func _enable_Panzer(value):
|
||||
buy_panzer_left += 1
|
||||
$VBoxContainer/ButtonGrid/Panzer.disabled = false
|
||||
|
10
Game.tscn
10
Game.tscn
@ -56,14 +56,14 @@ margin_right = 575.0
|
||||
custom_constants/hseparation = 21
|
||||
columns = 4
|
||||
|
||||
[node name="Spawner 1" type="Panel" parent="Spawner"]
|
||||
[node name="Spawner 1" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Spawner 2" type="Panel" parent="Spawner"]
|
||||
[node name="Spawner 2" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_left = 149.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 128.0
|
||||
@ -71,7 +71,7 @@ rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Spawner 3" type="Panel" parent="Spawner"]
|
||||
[node name="Spawner 3" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_left = 298.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 128.0
|
||||
@ -79,7 +79,7 @@ rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Spawner 4" type="Panel" parent="Spawner"]
|
||||
[node name="Spawner 4" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_left = 447.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 128.0
|
||||
@ -184,6 +184,7 @@ margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
disabled = true
|
||||
text = "Speed"
|
||||
|
||||
[node name="Panzer" type="Button" parent="VBoxContainer/ButtonGrid"]
|
||||
@ -192,6 +193,7 @@ margin_right = 260.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
disabled = true
|
||||
text = "Panzer"
|
||||
|
||||
[node name="Control" parent="." instance=ExtResource( 7 )]
|
||||
|
22
Overlay.tscn
22
Overlay.tscn
@ -1,13 +1,10 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Control
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
onready var pBar = $CanvasLayer/ProgressBar
|
||||
|
||||
signal full_bar
|
||||
@ -15,25 +12,25 @@ signal full_bar
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var Enemies = get_tree().get_nodes_in_group(\"Enemy\")
|
||||
for Enemy in Enemies:
|
||||
Enemy.connect(\"on_Death\", self, \"on_Death_listed\")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if pBar.value == pBar.max_value:
|
||||
var value = 50
|
||||
var value = 5
|
||||
emit_signal(\"full_bar\", value)
|
||||
pBar.value = 0
|
||||
pBar.max_value += 10
|
||||
pBar.max_value *= 1.2
|
||||
pass
|
||||
|
||||
func on_Death_listed(value):
|
||||
pBar.value += value
|
||||
"
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="Control" type="Control" groups=["XP"]]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -52,7 +49,8 @@ margin_top = 48.0
|
||||
margin_right = 48.0
|
||||
margin_bottom = 62.0
|
||||
rect_scale = Vector2( 1.5, 1.5 )
|
||||
max_value = 10.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
max_value = 5.0
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_right = 184.0
|
||||
|
@ -2,6 +2,8 @@ extends Panel
|
||||
|
||||
var enemy_pre = preload("res://Entity.tscn")
|
||||
var enemy = null
|
||||
var e_speed = 50
|
||||
var e_life = 2
|
||||
var Time = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
@ -13,8 +15,10 @@ func _ready():
|
||||
|
||||
func _process(delta):
|
||||
Time += delta
|
||||
if Time > 5:
|
||||
if Time > 3.5:
|
||||
if randi() % 2 == 0:
|
||||
enemy = enemy_pre.instance()
|
||||
enemy.speed = e_speed
|
||||
enemy.life = e_life
|
||||
add_child(enemy)
|
||||
Time = 0
|
||||
|
@ -83,6 +83,7 @@ window/size/width=576
|
||||
window/size/height=1200
|
||||
window/handheld/orientation="portrait"
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep_width"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user