67 lines
1.8 KiB
GDScript
67 lines
1.8 KiB
GDScript
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
|