mirror of
https://github.com/Yadciel1/2048-Shooter.git
synced 2024-12-26 06:47:02 +01:00
Big_update
This commit is contained in:
parent
58f6f31446
commit
044a36de7a
BIN
Export/Game.apk
Normal file
BIN
Export/Game.apk
Normal file
Binary file not shown.
BIN
Export/Game.apk.idsig
Normal file
BIN
Export/Game.apk.idsig
Normal file
Binary file not shown.
BIN
Export/Game.exe
BIN
Export/Game.exe
Binary file not shown.
BIN
Export/Game.pck
BIN
Export/Game.pck
Binary file not shown.
65
Game.gd
65
Game.gd
@ -1,65 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
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):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == BUTTON_LEFT && event.pressed:
|
||||
if holding_item != null:
|
||||
if!slot.Panzer:
|
||||
slot.putIntoSlot(holding_item)
|
||||
holding_item = null
|
||||
else:
|
||||
var temp_item = slot.Panzer
|
||||
slot.pickFromSlot()
|
||||
temp_item.global_position = event.global_position
|
||||
slot.putIntoSlot(holding_item)
|
||||
holding_item = temp_item
|
||||
elif slot.Panzer:
|
||||
holding_item = slot.Panzer
|
||||
slot.pickFromSlot()
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
|
||||
func _input(event):
|
||||
if holding_item:
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
pass
|
||||
|
||||
|
||||
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()
|
||||
add_child(Panzer)
|
||||
holding_item = Panzer
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
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
|
152
Main Scenes/Game.gd
Normal file
152
Main Scenes/Game.gd
Normal file
@ -0,0 +1,152 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
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 holding_item = null
|
||||
var buy_panzer_left = 0
|
||||
var life = 100
|
||||
var hover = null
|
||||
onready var start_panzer = 1
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
signal speed_shoot
|
||||
|
||||
func _ready():
|
||||
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
|
||||
var node = String("Slot ")
|
||||
node += rng.randi_range(1, 8) as String
|
||||
node = find_node(node)
|
||||
node.start_panzer += 1;
|
||||
$Panel/Area2D/LifeBar.value = life
|
||||
overlay_node.connect("score", self, "update_life_bar")
|
||||
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 _process(delta):
|
||||
if $Panel/Area2D/LifeBar.value == 0:
|
||||
get_tree().change_scene("res://Main Scenes/GameOver.tscn")
|
||||
|
||||
func slot_gui_input(event: InputEvent, slot: SlotClass):
|
||||
# if OS.get_name() != "Android":
|
||||
# if event is InputEventMouseButton:
|
||||
# if event.button_index == BUTTON_LEFT && event.pressed:
|
||||
# _Panzer_Slot_handler(event, slot)
|
||||
# else:
|
||||
if event is InputEventScreenTouch:
|
||||
if event.pressed:
|
||||
_Panzer_Slot_handler_touch(event, slot)
|
||||
else:
|
||||
if holding_item != null and hover == null and holding_item.old_slot != null:
|
||||
holding_item.old_slot.putIntoSlot(holding_item)
|
||||
holding_item = null
|
||||
elif holding_item != null and hover != null:
|
||||
drag_drop_handle(hover)
|
||||
else:
|
||||
pass
|
||||
pass
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventScreenDrag:
|
||||
if holding_item:
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
pass
|
||||
|
||||
|
||||
func _on_Panzer_pressed():
|
||||
if holding_item == null:
|
||||
buy_panzer_left -= 1
|
||||
if buy_panzer_left == 0:
|
||||
$VBoxContainer/ButtonGrid/Panzer.disabled = true
|
||||
var Panzer = null
|
||||
Panzer = Panzer_Temp.instance()
|
||||
add_child(Panzer)
|
||||
holding_item = Panzer
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
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
|
||||
|
||||
func update_life_bar():
|
||||
var lifebar = find_node("LifeBar")
|
||||
lifebar.value = lifebar.max_value
|
||||
pass
|
||||
|
||||
|
||||
func _on_Bullet_Grave_area_entered(area):
|
||||
if area.is_in_group("Bullet"):
|
||||
var Bullet = area.get_parent()
|
||||
Bullet.queue_free()
|
||||
pass # Replace with function body.
|
||||
|
||||
func _Panzer_Slot_handler(event: InputEvent, slot: SlotClass):
|
||||
if holding_item != null:
|
||||
if!slot.Panzer:
|
||||
slot.putIntoSlot(holding_item)
|
||||
holding_item = null
|
||||
elif slot.Panzer and holding_item.PanzerType == slot.Panzer.PanzerType:
|
||||
slot.upgradePanzerInSlot()
|
||||
holding_item.queue_free()
|
||||
holding_item = null
|
||||
else:
|
||||
print("yes")
|
||||
# var temp_item = slot.Panzer
|
||||
# slot.pickFromSlot()
|
||||
# temp_item.global_position = event.global_position
|
||||
# slot.putIntoSlot(holding_item)
|
||||
# holding_item = temp_item
|
||||
holding_item.old_slot.putIntoSlot(slot.Panzer)
|
||||
slot.Panzer.old_slot.putIntoSlot(holding_item)
|
||||
elif slot.Panzer:
|
||||
holding_item = slot.Panzer
|
||||
slot.pickFromSlot()
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
|
||||
func _Panzer_Slot_handler_touch(event: InputEvent, slot: SlotClass):
|
||||
if holding_item != null and holding_item.old_slot != slot:
|
||||
if!slot.Panzer:
|
||||
slot.putIntoSlot(holding_item)
|
||||
holding_item = null
|
||||
elif slot.Panzer and holding_item.PanzerType == slot.Panzer.PanzerType:
|
||||
slot.upgradePanzerInSlot()
|
||||
holding_item.queue_free()
|
||||
holding_item = null
|
||||
elif holding_item.old_slot != slot:
|
||||
pass
|
||||
elif slot.Panzer and holding_item == null:
|
||||
holding_item = slot.Panzer
|
||||
slot.pickFromSlot()
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
|
||||
func drag_drop_handle(hover):
|
||||
if!hover.Panzer:
|
||||
hover.putIntoSlot(holding_item)
|
||||
holding_item = null
|
||||
elif hover.Panzer and holding_item.PanzerType == hover.Panzer.PanzerType:
|
||||
hover.upgradePanzerInSlot()
|
||||
holding_item.queue_free()
|
||||
holding_item = null
|
||||
elif holding_item.old_slot != null:
|
||||
var temp = hover.Panzer
|
||||
var temp2 = holding_item
|
||||
hover.pickFromSlot()
|
||||
hover.putIntoSlot(holding_item)
|
||||
print(holding_item.old_slot)
|
||||
temp2.old_slot.putIntoSlot(temp)
|
||||
holding_item = null
|
||||
|
@ -1,12 +1,13 @@
|
||||
[gd_scene load_steps=13 format=2]
|
||||
[gd_scene load_steps=14 format=2]
|
||||
|
||||
[ext_resource path="res://box.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Slot.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Game.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Spawner.gd" type="Script" id=4]
|
||||
[ext_resource path="res://retrowave.png" type="Texture" id=5]
|
||||
[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://Main Scenes/Game.gd" type="Script" id=3]
|
||||
[ext_resource path="res://Objects/Slot.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://Objects/Spawner.gd" type="Script" id=5]
|
||||
[ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=6]
|
||||
[ext_resource path="res://Overlay.tscn" type="PackedScene" id=7]
|
||||
[ext_resource path="res://box.png" type="Texture" id=7]
|
||||
[ext_resource path="res://Objects/PanzerButton.tscn" type="PackedScene" id=8]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
|
||||
@ -14,23 +15,22 @@
|
||||
extents = Vector2( 288, 20 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=3]
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 8, 8 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=2]
|
||||
texture = ExtResource( 1 )
|
||||
texture = ExtResource( 7 )
|
||||
region_rect = Rect2( 0, 0, 8, 8 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
font_data = ExtResource( 6 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=6]
|
||||
extents = Vector2( 288, 40 )
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
[node name="Background" type="Sprite" parent="."]
|
||||
position = Vector2( 288, 592 )
|
||||
scale = Vector2( 0.463768, 0.5 )
|
||||
texture = ExtResource( 5 )
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
tile_set = SubResource( 1 )
|
||||
@ -44,6 +44,10 @@ rect_min_size = Vector2( 575, 32 )
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="Panel" groups=["Border"]]
|
||||
|
||||
[node name="LifeBar" type="ProgressBar" parent="Panel/Area2D"]
|
||||
margin_right = 576.0
|
||||
margin_bottom = 40.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Panel/Area2D"]
|
||||
position = Vector2( 288, 20 )
|
||||
shape = SubResource( 4 )
|
||||
@ -61,7 +65,7 @@ margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Spawner 2" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_left = 149.0
|
||||
@ -69,7 +73,7 @@ margin_right = 277.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Spawner 3" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_left = 298.0
|
||||
@ -77,7 +81,7 @@ margin_right = 426.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="Spawner 4" type="Panel" parent="Spawner" groups=["Spawner"]]
|
||||
margin_left = 447.0
|
||||
@ -85,7 +89,7 @@ margin_right = 575.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 4 )
|
||||
script = ExtResource( 5 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
margin_top = 800.0
|
||||
@ -99,79 +103,41 @@ custom_constants/vseparation = 10
|
||||
custom_constants/hseparation = 21
|
||||
columns = 4
|
||||
|
||||
[node name="Slot 1" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
[node name="Slot 1" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
|
||||
[node name="Slot 2" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 2" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_left = 149.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 3" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 3" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_left = 298.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 4" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 4" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_left = 447.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 5" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 5" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_top = 138.0
|
||||
margin_right = 128.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 6" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 6" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_left = 149.0
|
||||
margin_top = 138.0
|
||||
margin_right = 277.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 7" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 7" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_left = 298.0
|
||||
margin_top = 138.0
|
||||
margin_right = 426.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Slot 8" type="Panel" parent="VBoxContainer/PanzerSlots"]
|
||||
[node name="Slot 8" parent="VBoxContainer/PanzerSlots" instance=ExtResource( 4 )]
|
||||
margin_left = 447.0
|
||||
margin_top = 138.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 266.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="ButtonGrid" type="GridContainer" parent="VBoxContainer"]
|
||||
margin_top = 270.0
|
||||
@ -187,20 +153,21 @@ custom_fonts/font = SubResource( 5 )
|
||||
disabled = true
|
||||
text = "Speed"
|
||||
|
||||
[node name="Panzer" type="Button" parent="VBoxContainer/ButtonGrid"]
|
||||
margin_left = 132.0
|
||||
margin_right = 260.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
[node name="Panzer" parent="VBoxContainer/ButtonGrid" instance=ExtResource( 8 )]
|
||||
disabled = true
|
||||
text = "Panzer"
|
||||
|
||||
[node name="Control" parent="." instance=ExtResource( 7 )]
|
||||
[node name="Overlay" parent="." instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 575.0
|
||||
margin_bottom = 0.0
|
||||
|
||||
[node name="Bullet_Grave" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Bullet_Grave"]
|
||||
position = Vector2( 288, -40 )
|
||||
shape = SubResource( 6 )
|
||||
|
||||
[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"]
|
@ -20,7 +20,7 @@ func _ready():
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
get_tree().change_scene(\"res://Game.tscn\")
|
||||
get_tree().change_scene(\"res://Main Scenes/Game.tscn\")
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
68
Main Scenes/MainMenu.tscn
Normal file
68
Main Scenes/MainMenu.tscn
Normal file
@ -0,0 +1,68 @@
|
||||
[gd_scene load_steps=5 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]
|
||||
|
||||
[sub_resource type="GDScript" id=2]
|
||||
script/source = "extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
|
||||
func _on_Start_pressed():
|
||||
get_tree().change_scene(\"res://Main Scenes/Game.tscn\")
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[sub_resource type="DynamicFont" id=1]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
script = SubResource( 2 )
|
||||
|
||||
[node name="Background" type="Sprite" parent="."]
|
||||
position = Vector2( 288, 592 )
|
||||
scale = Vector2( 0.463768, 0.5 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 288.0
|
||||
margin_top = 504.0
|
||||
margin_right = 328.0
|
||||
margin_bottom = 544.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -180.0
|
||||
margin_top = -12.0
|
||||
margin_right = 140.0
|
||||
margin_bottom = 140.0
|
||||
|
||||
[node name="Button" type="Button" parent="Control/VBoxContainer"]
|
||||
margin_right = 320.0
|
||||
margin_bottom = 70.0
|
||||
rect_min_size = Vector2( 0, 70 )
|
||||
custom_fonts/font = SubResource( 1 )
|
||||
text = "Start"
|
||||
|
||||
[connection signal="pressed" from="Control/VBoxContainer/Button" to="." method="_on_Start_pressed"]
|
@ -9,6 +9,7 @@ script/source = "extends KinematicBody2D
|
||||
|
||||
var velocity = Vector2(0,-1)
|
||||
var speed = 300
|
||||
var hit_power = 2
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
@ -20,22 +21,16 @@ func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
move_and_collide(velocity.normalized() * delta * speed)
|
||||
pass
|
||||
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if !area.is_in_group(\"Border\"):
|
||||
queue_free()
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 3.33333, 3.33333 )
|
||||
|
||||
[node name="Node2D" type="KinematicBody2D"]
|
||||
[node name="Bullet" type="KinematicBody2D"]
|
||||
scale = Vector2( 1.5, 1.5 )
|
||||
z_index = 1
|
||||
script = SubResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
@ -51,5 +46,3 @@ shape = SubResource( 2 )
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2( 5.96046e-08, -5.96046e-08 )
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
|
@ -6,20 +6,25 @@
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends KinematicBody2D
|
||||
|
||||
var pre_bullet_hit = preload(\"res://Objects/bullet_hit.tscn\")
|
||||
var velocity = Vector2(0,1)
|
||||
var speed = 50
|
||||
var life = 2
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
signal on_Death
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var text = randi() % life as int
|
||||
$Label.text = (text+1) as String
|
||||
rng.randomize()
|
||||
var text = rng.randi_range(life/2, life)
|
||||
life = text
|
||||
$Label.text = (text) as String
|
||||
if(life > 9):
|
||||
pass
|
||||
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.
|
||||
|
||||
func _physics_process(delta):
|
||||
@ -28,22 +33,36 @@ func _physics_process(delta):
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if area.is_in_group(\"Bullet\"):
|
||||
var Bullet = area.get_parent()
|
||||
var text = $Label.text as int
|
||||
if text > 1:
|
||||
$Label.text = (text-1) as String
|
||||
var value = 1
|
||||
var bullet_hit = pre_bullet_hit.instance()
|
||||
var GameNode = find_parent(\"Game\")
|
||||
if text >= Bullet.hit_power:
|
||||
if text > Bullet.hit_power:
|
||||
$Label.text = (text-Bullet.hit_power) as String
|
||||
GameNode.add_child(bullet_hit)
|
||||
bullet_hit.global_position = Bullet.global_position
|
||||
bullet_hit.play()
|
||||
Bullet.queue_free()
|
||||
if text == Bullet.hit_power:
|
||||
GameNode.add_child(bullet_hit)
|
||||
bullet_hit.global_position = Bullet.global_position
|
||||
bullet_hit.play()
|
||||
emit_signal(\"on_Death\", value)
|
||||
Bullet.queue_free()
|
||||
queue_free()
|
||||
else:
|
||||
var value = 1
|
||||
GameNode.add_child(bullet_hit)
|
||||
bullet_hit.global_position = Bullet.global_position
|
||||
bullet_hit.play()
|
||||
Bullet.hit_power -= life
|
||||
emit_signal(\"on_Death\", value)
|
||||
queue_free()
|
||||
if area.is_in_group(\"Border\"):
|
||||
get_tree().change_scene(\"res://GameOver.tscn\")
|
||||
area.get_node(\"LifeBar\").value -= $Label.text as int
|
||||
queue_free()
|
||||
pass # Replace with function body.
|
||||
|
||||
func set_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]
|
||||
@ -53,7 +72,7 @@ extents = Vector2( 4, 4 )
|
||||
size = 12
|
||||
font_data = ExtResource( 2 )
|
||||
|
||||
[node name="Node2D" type="KinematicBody2D" groups=["Enemy"]]
|
||||
[node name="Entity" type="KinematicBody2D" groups=["Enemy"]]
|
||||
position = Vector2( 64, 64 )
|
||||
scale = Vector2( 12, 12 )
|
||||
script = SubResource( 1 )
|
||||
@ -79,6 +98,9 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rect_min_size = Vector2( 8, 8 )
|
||||
rect_scale = Vector2( 0.545, 0.639 )
|
||||
custom_colors/font_color = Color( 1, 0, 0, 1 )
|
||||
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
|
||||
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "1"
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Font/super-legend-boy-font/SuperLegendBoy-4w8Y.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
@ -8,7 +8,7 @@ script/source = "extends Control
|
||||
onready var pBar = $CanvasLayer/ProgressBar
|
||||
|
||||
signal full_bar
|
||||
|
||||
signal score
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
@ -17,21 +17,29 @@ func _ready():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
if ($CanvasLayer/Score.text as int % 100) == 0:
|
||||
emit_signal(\"score\")
|
||||
if pBar.value == pBar.max_value:
|
||||
var value = 5
|
||||
var value = 0.5
|
||||
emit_signal(\"full_bar\", value)
|
||||
pBar.value = 0
|
||||
pBar.max_value *= 1.2
|
||||
pBar.max_value *= 2
|
||||
pass
|
||||
|
||||
func on_Death_listed(value):
|
||||
pBar.value += value
|
||||
var score = $CanvasLayer/Score.text as int
|
||||
$CanvasLayer/Score.text = (score+1) as String
|
||||
"
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="Control" type="Control" groups=["XP"]]
|
||||
[sub_resource type="DynamicFont" id=3]
|
||||
size = 24
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[node name="Overlay" type="Control" groups=["XP"]]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_bottom = -1040.0
|
||||
@ -42,6 +50,7 @@ script = SubResource( 1 )
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="ProgressBar" type="ProgressBar" parent="CanvasLayer"]
|
||||
modulate = Color( 0, 1, 0.972549, 1 )
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
margin_left = -144.0
|
||||
@ -50,8 +59,16 @@ margin_right = 48.0
|
||||
margin_bottom = 62.0
|
||||
rect_scale = Vector2( 1.5, 1.5 )
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
max_value = 5.0
|
||||
max_value = 16.0
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
margin_right = 184.0
|
||||
margin_bottom = 160.0
|
||||
[node name="Score" type="Label" parent="CanvasLayer"]
|
||||
margin_left = 256.0
|
||||
margin_top = 16.0
|
||||
margin_right = 296.0
|
||||
margin_bottom = 39.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
custom_fonts/font = SubResource( 3 )
|
||||
text = "0"
|
||||
align = 1
|
||||
valign = 1
|
135
Objects/Panzer.tscn
Normal file
135
Objects/Panzer.tscn
Normal file
@ -0,0 +1,135 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tank Town V2.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Node2D
|
||||
|
||||
var Time = 0
|
||||
const bulletPath = preload(\"res:///Objects/Bullet.tscn\")
|
||||
var speed = 3
|
||||
onready var old_slot = null
|
||||
onready var GameNode
|
||||
var PanzerType = null
|
||||
var hit_power = 2
|
||||
|
||||
func _ready():
|
||||
GameNode = find_parent(\"Game\")
|
||||
GameNode.connect(\"speed_shoot\", self, \"set_shoot_speed\")
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
if get_parent().is_class(\"Panel\"):
|
||||
old_slot = get_parent()
|
||||
PanzerType(PanzerType)
|
||||
Time += delta
|
||||
if Time > speed and get_parent() != GameNode: #wenn er nicht gehoben wird dann:
|
||||
shoot()
|
||||
Time = 0
|
||||
pass
|
||||
|
||||
func shoot():
|
||||
$Shoot.visible = true
|
||||
$Shoot/AnimationPlayer.play(\"Shoot\")
|
||||
var bullet = bulletPath.instance()
|
||||
bullet.hit_power = hit_power
|
||||
find_parent(\"Game\").add_child(bullet)
|
||||
bullet.position = $Position2D.global_position
|
||||
|
||||
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:
|
||||
$Sprite.region_rect = Rect2(0, 80, 16, 16)
|
||||
if PanzerType == 4:
|
||||
$Sprite.modulate = Color(0.875, 0, 1)
|
||||
$Sprite.region_rect = Rect2(0, 80, 16, 16)
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_AnimationPlayer_shoot_finished(anim_name):
|
||||
$Shoot.visible = false
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ 60 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=3]
|
||||
resource_name = "Shoot"
|
||||
length = 0.6
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.6 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ 60, 63 ]
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=4]
|
||||
extents = Vector2( 12, 12 )
|
||||
|
||||
[node name="ShooterObject" type="Node2D"]
|
||||
position = Vector2( 64, 64 )
|
||||
scale = Vector2( 2, 2 )
|
||||
z_index = 1
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 3, 3 )
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 48, 16, 16 )
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( 0.5, -28 )
|
||||
|
||||
[node name="Shoot" type="Node2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2( 0, -40 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Shoot"]
|
||||
scale = Vector2( 2, 2 )
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 10
|
||||
vframes = 12
|
||||
frame = 60
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Shoot"]
|
||||
anims/RESET = SubResource( 2 )
|
||||
anims/Shoot = SubResource( 3 )
|
||||
|
||||
[node name="panzerArea" type="Area2D" parent="." groups=["Panzer"]]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="panzerArea"]
|
||||
shape = SubResource( 4 )
|
||||
|
||||
[connection signal="animation_finished" from="Shoot/AnimationPlayer" to="." method="_on_AnimationPlayer_shoot_finished"]
|
35
Objects/PanzerButton.tscn
Normal file
35
Objects/PanzerButton.tscn
Normal file
@ -0,0 +1,35 @@
|
||||
[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="DynamicFont" id=5]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="GDScript" id=6]
|
||||
script/source = "extends Button
|
||||
|
||||
var Panzer = preload(\"res://Objects/Panzer.tscn\")
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
"
|
||||
|
||||
[node name="PanzerButton" type="Button"]
|
||||
margin_left = 132.0
|
||||
margin_right = 260.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Panzer"
|
||||
script = SubResource( 6 )
|
45
Objects/Slot.gd
Normal file
45
Objects/Slot.gd
Normal file
@ -0,0 +1,45 @@
|
||||
extends Panel
|
||||
|
||||
var PanzerType = preload("res://Objects/Panzer.tscn")
|
||||
var Panzer = null
|
||||
var start_panzer = 0
|
||||
|
||||
func _process(delta):
|
||||
if start_panzer > 0:
|
||||
if randi() % 2 == 0:
|
||||
Panzer = PanzerType.instance()
|
||||
add_child(Panzer)
|
||||
start_panzer -= 1
|
||||
|
||||
|
||||
func pickFromSlot():
|
||||
remove_child(Panzer)
|
||||
var GameNode = find_parent("Game")
|
||||
GameNode.add_child(Panzer)
|
||||
Panzer = null
|
||||
|
||||
func putIntoSlot(new_panzer):
|
||||
Panzer = new_panzer
|
||||
Panzer.position = Vector2(64, 64)
|
||||
var GameNode = find_parent("Game")
|
||||
GameNode.remove_child(Panzer)
|
||||
add_child(Panzer)
|
||||
|
||||
func upgradePanzerInSlot():
|
||||
Panzer.hit_power *= 2
|
||||
if Panzer.PanzerType != null:
|
||||
Panzer.PanzerType += 1
|
||||
else:
|
||||
Panzer.PanzerType = 2
|
||||
pass
|
||||
|
||||
func _set_start_panzer(value):
|
||||
start_panzer += value
|
||||
|
||||
|
||||
func _on_slotshape_area_entered(area):
|
||||
if area.is_in_group("Panzer"):
|
||||
var GameNode = find_parent("Game")
|
||||
if GameNode.holding_item != null:
|
||||
GameNode.hover = self
|
||||
pass # Replace with function body.
|
27
Objects/Slot.tscn
Normal file
27
Objects/Slot.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Objects/Slot.gd" type="Script" id=1]
|
||||
[ext_resource path="res://box.png" type="Texture" id=2]
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=2]
|
||||
texture = ExtResource( 2 )
|
||||
region_rect = Rect2( 0, 0, 8, 8 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 56, 56 )
|
||||
|
||||
[node name="Slot" type="Panel"]
|
||||
margin_right = 128.0
|
||||
margin_bottom = 128.0
|
||||
rect_min_size = Vector2( 128, 128 )
|
||||
rect_pivot_offset = Vector2( 64, 64 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="slotshape" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="slotshape"]
|
||||
position = Vector2( 64, 64 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[connection signal="area_entered" from="slotshape" to="." method="_on_slotshape_area_entered"]
|
47
Objects/Spawner.gd
Normal file
47
Objects/Spawner.gd
Normal file
@ -0,0 +1,47 @@
|
||||
extends Panel
|
||||
|
||||
var enemy_pre = preload("res://Objects/Entity.tscn")
|
||||
var item_pre = preload("res://Objects/item.tscn")
|
||||
var enemy = null
|
||||
var item = null
|
||||
var e_speed = 50
|
||||
var e_life = 2
|
||||
var spawn_rate = 4
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var Time = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
if rng.randi_range(0, spawn_rate) == 0:
|
||||
enemy = enemy_pre.instance()
|
||||
add_child(enemy)
|
||||
var Progressbars = get_tree().get_nodes_in_group("XP")
|
||||
for Progressbar in Progressbars:
|
||||
Progressbar.connect("full_bar", self, "set_spawn_values")
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
Time += delta
|
||||
if Time > 3.5:
|
||||
rng.randomize()
|
||||
if rng.randi_range(0, spawn_rate) == 0:
|
||||
if rng.randi_range(0, 10) != 0:
|
||||
enemy = enemy_pre.instance()
|
||||
enemy.speed = e_speed
|
||||
enemy.life = e_life
|
||||
add_child(enemy)
|
||||
else:
|
||||
item = item_pre.instance()
|
||||
item.speed = e_speed
|
||||
add_child(item)
|
||||
Time = 0
|
||||
|
||||
|
||||
|
||||
func set_spawn_values(value):
|
||||
e_speed += value
|
||||
e_life *= 2
|
||||
if (spawn_rate > 2):
|
||||
spawn_rate -= 1
|
||||
pass
|
88
Objects/bullet_hit.tscn
Normal file
88
Objects/bullet_hit.tscn
Normal file
@ -0,0 +1,88 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tank Town V2.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=3]
|
||||
script/source = "extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = \"text\"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
func play():
|
||||
$AnimationPlayer.play(\"Hit\")
|
||||
pass
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
queue_free()
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[sub_resource type="Animation" id=1]
|
||||
resource_name = "Hit"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.3 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ 70, 75 ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=2]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("AnimationPlayer:reset_on_save")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ true ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:frame")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ 70 ]
|
||||
}
|
||||
|
||||
[node name="bullet_hit" type="Node2D"]
|
||||
script = SubResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 2, 2 )
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 10
|
||||
vframes = 12
|
||||
frame = 70
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/Hit = SubResource( 1 )
|
||||
anims/RESET = SubResource( 2 )
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
|
72
Objects/item.tscn
Normal file
72
Objects/item.tscn
Normal file
@ -0,0 +1,72 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tank Town V2.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends KinematicBody2D
|
||||
|
||||
var pre_bullet_hit = preload(\"res://Objects/bullet_hit.tscn\")
|
||||
var velocity = Vector2(0,1)
|
||||
var speed = 50
|
||||
var life = 1
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
signal on_Death
|
||||
signal badget
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
var Progressbars = get_tree().get_nodes_in_group(\"XP\")
|
||||
for Progressbar in Progressbars:
|
||||
self.connect(\"on_Death\",Progressbar, \"on_Death_listed\")
|
||||
var GameNode = find_parent(\"Game\")
|
||||
connect(\"badget\", GameNode, \"_enable_Panzer\")
|
||||
pass # Replace with function body.
|
||||
|
||||
func _physics_process(delta):
|
||||
move_and_collide(velocity.normalized() * delta * speed)
|
||||
pass
|
||||
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
var value = 1
|
||||
var bullet_hit = pre_bullet_hit.instance()
|
||||
var GameNode = find_parent(\"Game\")
|
||||
if area.is_in_group(\"Bullet\"):
|
||||
var Bullet = area.get_parent()
|
||||
GameNode.add_child(bullet_hit)
|
||||
bullet_hit.global_position = Bullet.global_position
|
||||
bullet_hit.play()
|
||||
emit_signal(\"on_Death\", value)
|
||||
emit_signal(\"badget\", value)
|
||||
queue_free()
|
||||
pass # Replace with function body.
|
||||
"
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=3]
|
||||
extents = Vector2( 7, 7 )
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=2]
|
||||
extents = Vector2( 7.83333, 7.83333 )
|
||||
|
||||
[node name="Item" type="KinematicBody2D"]
|
||||
position = Vector2( 64, 64 )
|
||||
scale = Vector2( 8, 8 )
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
hframes = 10
|
||||
vframes = 12
|
||||
frame = 48
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"]
|
51
Panzer.tscn
51
Panzer.tscn
@ -1,51 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/Tank Town V2.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Node2D
|
||||
|
||||
var Time = 0
|
||||
const bulletPath = preload(\"res://Bullet.tscn\")
|
||||
var speed = 2.5
|
||||
onready var GameNode
|
||||
|
||||
func _ready():
|
||||
GameNode = find_parent(\"Game\")
|
||||
GameNode.connect(\"speed_shoot\", self, \"set_shoot_speed\")
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
Time += delta
|
||||
if Time > speed and get_parent() != GameNode: #wenn er nicht gehoben wird dann:
|
||||
shoot()
|
||||
Time = 0
|
||||
pass
|
||||
|
||||
func shoot():
|
||||
var bullet = bulletPath.instance()
|
||||
find_parent(\"Game\").add_child(bullet)
|
||||
bullet.position = $Position2D.global_position
|
||||
|
||||
func set_shoot_speed(value):
|
||||
if speed != 0.5:
|
||||
speed -= value
|
||||
print(speed)
|
||||
pass
|
||||
"
|
||||
|
||||
[node name="ShooterObject" type="Node2D"]
|
||||
position = Vector2( 64, 64 )
|
||||
scale = Vector2( 2, 2 )
|
||||
z_index = 1
|
||||
script = SubResource( 1 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
scale = Vector2( 3, 3 )
|
||||
z_index = 1
|
||||
texture = ExtResource( 1 )
|
||||
region_enabled = true
|
||||
region_rect = Rect2( 0, 48, 16, 16 )
|
||||
|
||||
[node name="Position2D" type="Position2D" parent="."]
|
||||
position = Vector2( 0.5, -28 )
|
24
Slot.gd
24
Slot.gd
@ -1,24 +0,0 @@
|
||||
extends Panel
|
||||
|
||||
var PanzerType = preload("res://Panzer.tscn")
|
||||
var Panzer = null
|
||||
|
||||
func _ready():
|
||||
if randi() % 2 == 0:
|
||||
Panzer = PanzerType.instance()
|
||||
add_child(Panzer)
|
||||
|
||||
|
||||
func pickFromSlot():
|
||||
remove_child(Panzer)
|
||||
var GameNode = find_parent("Game")
|
||||
GameNode.add_child(Panzer)
|
||||
Panzer = null
|
||||
|
||||
func putIntoSlot(new_panzer):
|
||||
Panzer = new_panzer
|
||||
Panzer.position = Vector2(64, 64)
|
||||
var GameNode = find_parent("Game")
|
||||
GameNode.remove_child(Panzer)
|
||||
add_child(Panzer)
|
||||
|
24
Spawner.gd
24
Spawner.gd
@ -1,24 +0,0 @@
|
||||
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.
|
||||
func _ready():
|
||||
if randi() % 2 == 0:
|
||||
enemy = enemy_pre.instance()
|
||||
add_child(enemy)
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
Time += delta
|
||||
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
|
@ -40,3 +40,209 @@ application/product_name=""
|
||||
application/file_description=""
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Android"
|
||||
platform="Android"
|
||||
runnable=true
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="Export/Game.apk"
|
||||
script_export_mode=1
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
custom_build/use_custom_build=false
|
||||
custom_build/export_format=0
|
||||
custom_build/min_sdk=""
|
||||
custom_build/target_sdk=""
|
||||
architectures/armeabi-v7a=true
|
||||
architectures/arm64-v8a=true
|
||||
architectures/x86=false
|
||||
architectures/x86_64=false
|
||||
keystore/debug=""
|
||||
keystore/debug_user=""
|
||||
keystore/debug_password=""
|
||||
keystore/release="E:/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738/jre/bin/mygame.keystore"
|
||||
keystore/release_user="mygame"
|
||||
keystore/release_password="Hopper7204"
|
||||
one_click_deploy/clear_previous_install=false
|
||||
version/code=1
|
||||
version/name="1.0"
|
||||
package/unique_name="org.godotengine.$genname"
|
||||
package/name=""
|
||||
package/signed=true
|
||||
package/classify_as_game=true
|
||||
package/retain_data_on_uninstall=false
|
||||
package/exclude_from_recents=false
|
||||
launcher_icons/main_192x192=""
|
||||
launcher_icons/adaptive_foreground_432x432=""
|
||||
launcher_icons/adaptive_background_432x432=""
|
||||
graphics/opengl_debug=false
|
||||
xr_features/xr_mode=0
|
||||
xr_features/hand_tracking=0
|
||||
xr_features/hand_tracking_frequency=0
|
||||
xr_features/passthrough=0
|
||||
screen/immersive_mode=true
|
||||
screen/support_small=true
|
||||
screen/support_normal=true
|
||||
screen/support_large=true
|
||||
screen/support_xlarge=true
|
||||
user_data_backup/allow=false
|
||||
command_line/extra_args=""
|
||||
apk_expansion/enable=false
|
||||
apk_expansion/SALT=""
|
||||
apk_expansion/public_key=""
|
||||
permissions/custom_permissions=PoolStringArray( )
|
||||
permissions/access_checkin_properties=false
|
||||
permissions/access_coarse_location=false
|
||||
permissions/access_fine_location=false
|
||||
permissions/access_location_extra_commands=false
|
||||
permissions/access_mock_location=false
|
||||
permissions/access_network_state=false
|
||||
permissions/access_surface_flinger=false
|
||||
permissions/access_wifi_state=false
|
||||
permissions/account_manager=false
|
||||
permissions/add_voicemail=false
|
||||
permissions/authenticate_accounts=false
|
||||
permissions/battery_stats=false
|
||||
permissions/bind_accessibility_service=false
|
||||
permissions/bind_appwidget=false
|
||||
permissions/bind_device_admin=false
|
||||
permissions/bind_input_method=false
|
||||
permissions/bind_nfc_service=false
|
||||
permissions/bind_notification_listener_service=false
|
||||
permissions/bind_print_service=false
|
||||
permissions/bind_remoteviews=false
|
||||
permissions/bind_text_service=false
|
||||
permissions/bind_vpn_service=false
|
||||
permissions/bind_wallpaper=false
|
||||
permissions/bluetooth=false
|
||||
permissions/bluetooth_admin=false
|
||||
permissions/bluetooth_privileged=false
|
||||
permissions/brick=false
|
||||
permissions/broadcast_package_removed=false
|
||||
permissions/broadcast_sms=false
|
||||
permissions/broadcast_sticky=false
|
||||
permissions/broadcast_wap_push=false
|
||||
permissions/call_phone=false
|
||||
permissions/call_privileged=false
|
||||
permissions/camera=false
|
||||
permissions/capture_audio_output=false
|
||||
permissions/capture_secure_video_output=false
|
||||
permissions/capture_video_output=false
|
||||
permissions/change_component_enabled_state=false
|
||||
permissions/change_configuration=false
|
||||
permissions/change_network_state=false
|
||||
permissions/change_wifi_multicast_state=false
|
||||
permissions/change_wifi_state=false
|
||||
permissions/clear_app_cache=false
|
||||
permissions/clear_app_user_data=false
|
||||
permissions/control_location_updates=false
|
||||
permissions/delete_cache_files=false
|
||||
permissions/delete_packages=false
|
||||
permissions/device_power=false
|
||||
permissions/diagnostic=false
|
||||
permissions/disable_keyguard=false
|
||||
permissions/dump=false
|
||||
permissions/expand_status_bar=false
|
||||
permissions/factory_test=false
|
||||
permissions/flashlight=false
|
||||
permissions/force_back=false
|
||||
permissions/get_accounts=false
|
||||
permissions/get_package_size=false
|
||||
permissions/get_tasks=false
|
||||
permissions/get_top_activity_info=false
|
||||
permissions/global_search=false
|
||||
permissions/hardware_test=false
|
||||
permissions/inject_events=false
|
||||
permissions/install_location_provider=false
|
||||
permissions/install_packages=false
|
||||
permissions/install_shortcut=false
|
||||
permissions/internal_system_window=false
|
||||
permissions/internet=false
|
||||
permissions/kill_background_processes=false
|
||||
permissions/location_hardware=false
|
||||
permissions/manage_accounts=false
|
||||
permissions/manage_app_tokens=false
|
||||
permissions/manage_documents=false
|
||||
permissions/manage_external_storage=false
|
||||
permissions/master_clear=false
|
||||
permissions/media_content_control=false
|
||||
permissions/modify_audio_settings=false
|
||||
permissions/modify_phone_state=false
|
||||
permissions/mount_format_filesystems=false
|
||||
permissions/mount_unmount_filesystems=false
|
||||
permissions/nfc=false
|
||||
permissions/persistent_activity=false
|
||||
permissions/process_outgoing_calls=false
|
||||
permissions/read_calendar=false
|
||||
permissions/read_call_log=false
|
||||
permissions/read_contacts=false
|
||||
permissions/read_external_storage=false
|
||||
permissions/read_frame_buffer=false
|
||||
permissions/read_history_bookmarks=false
|
||||
permissions/read_input_state=false
|
||||
permissions/read_logs=false
|
||||
permissions/read_phone_state=false
|
||||
permissions/read_profile=false
|
||||
permissions/read_sms=false
|
||||
permissions/read_social_stream=false
|
||||
permissions/read_sync_settings=false
|
||||
permissions/read_sync_stats=false
|
||||
permissions/read_user_dictionary=false
|
||||
permissions/reboot=false
|
||||
permissions/receive_boot_completed=false
|
||||
permissions/receive_mms=false
|
||||
permissions/receive_sms=false
|
||||
permissions/receive_wap_push=false
|
||||
permissions/record_audio=false
|
||||
permissions/reorder_tasks=false
|
||||
permissions/restart_packages=false
|
||||
permissions/send_respond_via_message=false
|
||||
permissions/send_sms=false
|
||||
permissions/set_activity_watcher=false
|
||||
permissions/set_alarm=false
|
||||
permissions/set_always_finish=false
|
||||
permissions/set_animation_scale=false
|
||||
permissions/set_debug_app=false
|
||||
permissions/set_orientation=false
|
||||
permissions/set_pointer_speed=false
|
||||
permissions/set_preferred_applications=false
|
||||
permissions/set_process_limit=false
|
||||
permissions/set_time=false
|
||||
permissions/set_time_zone=false
|
||||
permissions/set_wallpaper=false
|
||||
permissions/set_wallpaper_hints=false
|
||||
permissions/signal_persistent_processes=false
|
||||
permissions/status_bar=false
|
||||
permissions/subscribed_feeds_read=false
|
||||
permissions/subscribed_feeds_write=false
|
||||
permissions/system_alert_window=false
|
||||
permissions/transmit_ir=false
|
||||
permissions/uninstall_shortcut=false
|
||||
permissions/update_device_stats=false
|
||||
permissions/use_credentials=false
|
||||
permissions/use_sip=false
|
||||
permissions/vibrate=false
|
||||
permissions/wake_lock=false
|
||||
permissions/write_apn_settings=false
|
||||
permissions/write_calendar=false
|
||||
permissions/write_call_log=false
|
||||
permissions/write_contacts=false
|
||||
permissions/write_external_storage=false
|
||||
permissions/write_gservices=false
|
||||
permissions/write_history_bookmarks=false
|
||||
permissions/write_profile=false
|
||||
permissions/write_secure_settings=false
|
||||
permissions/write_settings=false
|
||||
permissions/write_sms=false
|
||||
permissions/write_social_stream=false
|
||||
permissions/write_sync_settings=false
|
||||
permissions/write_user_dictionary=false
|
||||
|
@ -70,7 +70,7 @@ config={
|
||||
[application]
|
||||
|
||||
config/name="2048 shooter"
|
||||
run/main_scene="res://Game.tscn"
|
||||
run/main_scene="res://Main Scenes/MainMenu.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
@ -83,7 +83,7 @@ window/size/width=576
|
||||
window/size/height=1200
|
||||
window/handheld/orientation="portrait"
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep_width"
|
||||
window/stretch/aspect="keep_height"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
@ -117,6 +117,10 @@ texture={
|
||||
"svg/scale": 1.0
|
||||
}
|
||||
|
||||
[input_devices]
|
||||
|
||||
pointing/emulate_touch_from_mouse=true
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
Loading…
Reference in New Issue
Block a user