Initial commit (1/2)

This commit is contained in:
Алкесей Мирнеков 2023-11-05 16:23:18 +03:00 committed by GitHub
commit 3411c5796d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 2261 additions and 0 deletions

View file

@ -0,0 +1,12 @@
extends BuyMenuButton
func bought_action():
if PlayerShip.Hull.HP >= PlayerShip.Hull.MaxHP:
PlayerShip.Hull.HP = PlayerShip.Hull.MaxHP
PlayerShip.Money += Price
return
PlayerShip.Hull.HP += 1
while(PlayerShip.Hull.HP < PlayerShip.Hull.MaxHP and PlayerShip.Money >= Price):
PlayerShip.Hull.HP += 1
PlayerShip.Money -= Price
if PlayerShip.Hull.HP > PlayerShip.Hull.MaxHP: PlayerShip.Hull.HP = PlayerShip.Hull.MaxHP

View file

@ -0,0 +1,29 @@
extends BuyMenuButton
class_name BuyWeaponMenuButton
@export var AddedWeapon : String
@export var Slot : String = "primary"
@export var Position : Vector2 = Vector2.ZERO
@onready var PrimarySlot = get_tree().current_scene.get_node("MainShip/PrimaryWeapon")
@onready var SecondarySlot = get_tree().current_scene.get_node("MainShip/SecondaryWeapon")
@onready var BoughtWeapon = get_tree().current_scene.BoughtWeapon
@onready var WeaponDict = get_tree().current_scene.WeaponDict
func bought_action():
var SlotInst = PrimarySlot if Slot == "primary" else SecondarySlot
if !BoughtWeapon[AddedWeapon]:
BoughtWeapon[AddedWeapon] = true
else:
PlayerShip.Money += Price
if SlotInst.get_child_count() == 0:
var AddingWeapon = load(WeaponDict[AddedWeapon]).instantiate()
SlotInst.add_child(AddingWeapon)
SlotInst.position = Position
else:
for node in SlotInst.get_children():
node.queue_free()
var AddingWeapon = load(WeaponDict[AddedWeapon]).instantiate()
SlotInst.add_child(AddingWeapon)
SlotInst.position = Position

View file

@ -0,0 +1,16 @@
extends BuyMenuButton
@export var RocketsAmount : float = 5
@onready var RocketPrice : float = Price / RocketsAmount
func bought_action():
if PlayerShip.Hull.Ammunition["Rockets"] == PlayerShip.Hull.MaxAmmunition["Rockets"]: PlayerShip.Money += Price
else:
if PlayerShip.Hull.Ammunition["Rockets"] + RocketsAmount > PlayerShip.Hull.MaxAmmunition["Rockets"]:
var RocketsLeft = PlayerShip.Hull.MaxAmmunition["Rockets"] - PlayerShip.Hull.Ammunition["Rockets"]
for i in range(RocketsLeft + 1):
PlayerShip.Money += RocketPrice
PlayerShip.Hull.Ammunition["Rockets"] = PlayerShip.Hull.MaxAmmunition["Rockets"]
else:
PlayerShip.Hull.Ammunition["Rockets"] += RocketsAmount

View file

@ -0,0 +1,9 @@
extends BuyMenuButton
@export var TurboAmount : float = 1000
func bought_action():
if PlayerShip.Hull.Fuel == PlayerShip.Hull.MaxFuel: PlayerShip.Money += Price
else:
if PlayerShip.Hull.Fuel + TurboAmount > PlayerShip.Hull.MaxFuel: PlayerShip.Hull.Fuel = PlayerShip.Hull.MaxFuel
else: PlayerShip.Hull.Fuel += TurboAmount

View file

@ -0,0 +1,4 @@
extends MenuDefaultButton
func action():
get_tree().current_scene.recolor()

4
scenes/menus/ResetMS.gd Normal file
View file

@ -0,0 +1,4 @@
extends MenuDefaultButton
func action():
PlayerShip.destroy()

View file

@ -0,0 +1,364 @@
[gd_scene load_steps=9 format=3 uid="uid://dj8iw5305ujrc"]
[ext_resource type="Texture2D" uid="uid://db4euprxhape0" path="res://sprites/9s.png" id="1_osomq"]
[ext_resource type="Script" path="res://scenes/menus/BuyMenuTurbo.gd" id="2_0mgmw"]
[ext_resource type="Script" path="res://scenes/menus/BuyMenuHealth.gd" id="3_ciur0"]
[ext_resource type="Script" path="res://scenes/menus/BuyMenuRockets.gd" id="4_aae7g"]
[ext_resource type="Script" path="res://scenes/menus/BuyMenuLaser.gd" id="5_45gom"]
[ext_resource type="Script" path="res://scenes/menus/OptionsColors.gd" id="7_m7aa1"]
[ext_resource type="Script" path="res://scenes/menus/ResetMS.gd" id="8_uifkj"]
[sub_resource type="LabelSettings" id="LabelSettings_7bj0u"]
font_size = 14
[node name="StarterBaseMenu" type="Control"]
process_mode = 1
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="BuyMenu" type="NinePatchRect" parent="."]
layout_mode = 1
anchors_preset = -1
offset_left = 295.0
offset_top = 92.0
offset_right = 551.0
offset_bottom = 348.0
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="Option1" type="NinePatchRect" parent="BuyMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = -0.0480001
offset_top = -0.0480001
offset_right = 0.0479889
offset_bottom = -0.0160027
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("2_0mgmw")
Price = 50.0
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="BuyMenu/Option1"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="BuyMenu/Option1"]
layout_mode = 0
offset_right = 251.0
offset_bottom = 52.0
text = "50 Money Units >> 1k Fuel Units
No refund"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Option2" type="NinePatchRect" parent="BuyMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = -0.0480001
offset_top = 69.952
offset_right = 0.0480042
offset_bottom = 69.984
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("3_ciur0")
Price = 2.0
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="BuyMenu/Option2"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="BuyMenu/Option2"]
layout_mode = 0
offset_right = 251.0
offset_bottom = 52.0
text = "2 Money Units >> 1 Hull Strength
Up to a maximum"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Option3" type="NinePatchRect" parent="BuyMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = -0.0480001
offset_top = 137.952
offset_right = 0.0480042
offset_bottom = 137.984
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("4_aae7g")
Price = 20.0
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="BuyMenu/Option3"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="BuyMenu/Option3"]
layout_mode = 0
offset_right = 251.0
offset_bottom = 52.0
text = "20 Money Units >> 5 Rockets
Refund if too many"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Option4" type="NinePatchRect" parent="BuyMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = -0.0480001
offset_top = 199.952
offset_right = -155.952
offset_bottom = 199.984
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("5_45gom")
AddedWeapon = "SingleRocketMk1"
Slot = "secondary"
Position = Vector2(16, 0)
Price = 200.0
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="BuyMenu/Option4"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="BuyMenu/Option4"]
layout_mode = 0
offset_right = 96.0
offset_bottom = 52.0
text = "200 MU >> Sin
gleRocketMk1"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Option5" type="NinePatchRect" parent="BuyMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = 96.952
offset_top = 199.952
offset_right = -59.952
offset_bottom = 199.984
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("5_45gom")
AddedWeapon = "DoubleLaserMk1"
Position = Vector2(8, 0)
Price = 300.0
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="BuyMenu/Option5"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="BuyMenu/Option5"]
layout_mode = 0
offset_right = 95.0
offset_bottom = 52.0
text = "300 MU >> Do
ubleLaserMk1"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Option6" type="NinePatchRect" parent="BuyMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = 193.952
offset_top = 199.952
offset_right = 0.0480042
offset_bottom = 199.984
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("5_45gom")
AddedWeapon = "SingleLaserMk1"
Position = Vector2(8, 0)
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="BuyMenu/Option6"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="BuyMenu/Option6"]
layout_mode = 0
offset_right = 58.0
offset_bottom = 52.0
text = "SingleLa
serMk1"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="OptionsMenu" type="NinePatchRect" parent="."]
layout_mode = 1
anchors_preset = -1
offset_left = 695.0
offset_top = 91.0
offset_right = 951.0
offset_bottom = 347.0
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
[node name="Colors" type="NinePatchRect" parent="OptionsMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = -0.0480001
offset_top = -0.0480001
offset_right = 0.0479889
offset_bottom = -0.0160027
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("7_m7aa1")
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="OptionsMenu/Colors"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="OptionsMenu/Colors"]
layout_mode = 0
offset_right = 251.0
offset_bottom = 52.0
text = "Randomize colors"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1
[node name="ResetMS" type="NinePatchRect" parent="OptionsMenu" node_paths=PackedStringArray("Clickable")]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.008
anchor_top = 0.008
anchor_right = 0.992
anchor_bottom = 0.211
offset_left = -0.0480001
offset_top = 72.952
offset_right = 0.0479889
offset_bottom = 72.984
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("1_osomq")
region_rect = Rect2(0, 0, 5, 5)
patch_margin_left = 2
patch_margin_top = 2
patch_margin_right = 2
patch_margin_bottom = 2
script = ExtResource("8_uifkj")
Clickable = NodePath("TextureButton")
[node name="TextureButton" type="TextureButton" parent="OptionsMenu/ResetMS"]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
anchor_bottom = 1.0
[node name="Label" type="Label" parent="OptionsMenu/ResetMS"]
layout_mode = 0
offset_right = 251.0
offset_bottom = 52.0
text = "Reset Main Ship"
label_settings = SubResource("LabelSettings_7bj0u")
horizontal_alignment = 1
vertical_alignment = 1