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

67
scripts/Space.gd Normal file
View file

@ -0,0 +1,67 @@
extends Node2D
var CanTarget = []
var WeaponDict = {
"SingleRocketMk1" : "res://scenes/weapons/presets/SingleRocketMk1.tscn",
"DoubleLaserMk1" : "res://scenes/weapons/presets/DoubleLaserMk1.tscn",
"SingleLaserMk1" : "res://scenes/weapons/presets/SingleLaserMk1.tscn"
}
var BoughtWeapon : Dictionary = WeaponDict.duplicate()
var ColorPlayer
var ColorBaseMenu
var ColorEnemyFaction
@export var MapWidth = 8192
@export var MapHeight = 8192
@onready var Player = $MainShip
@onready var Base = $StarterBase
@onready var EnemyFaction = $EnemyFaction
func _ready():
randomize()
recolor()
for key in BoughtWeapon:
BoughtWeapon[key] = false
BoughtWeapon["SingleLaserMk1"] = true
Player.Camera.limit_left = -MapWidth/2.0
Player.Camera.limit_right = MapWidth/2.0
Player.Camera.limit_top = -MapHeight/2.0
Player.Camera.limit_bottom = MapHeight/2.0
func addtargetlist(body : Node2D):
if !CanTarget.has(body):
CanTarget.append(body)
func removetargetlist(body : Node2D):
if CanTarget.has(body):
CanTarget.erase(body)
func _process(_delta):
if Input.is_action_just_released("pause"):
if get_tree().paused:
unpause()
else:
pause()
func pause():
get_tree().paused = true
Player.PauseController.visible = true
func unpause():
get_tree().paused = false
Player.PauseController.visible = false
func recolor():
ColorPlayer = Color.from_hsv(randf(), randf_range(0.8, 1), randf_range(0.8, 1))
ColorBaseMenu = Color.from_hsv(randf(), randf_range(0.8, 1), randf_range(0.8, 1))
ColorEnemyFaction = Color.from_hsv(randf(), randf_range(0.8, 1), randf_range(0.8, 1))
Player.modulate = ColorPlayer
Base.modulate = ColorBaseMenu
EnemyFaction.modulate = ColorEnemyFaction
EnemyFaction.changeitemscolor()
Player.changeinterfacecolor()
var Menu = get_node_or_null("MainShip/GUI/StarterBaseMenu")
if Menu != null:
Menu.modulate = Base.modulate