57 lines
2.1 KiB
GDScript
57 lines
2.1 KiB
GDScript
extends Node2D
|
|
|
|
func _ready() -> void:
|
|
GameState.start_new_run()
|
|
var game := preload("res://scenes/game/game.tscn").instantiate()
|
|
add_child(game)
|
|
game.set_physics_process(false)
|
|
var ship: CharacterBody2D = game.player
|
|
ship.set_physics_process(false)
|
|
ship.get_node("WeaponController").set_physics_process(false)
|
|
ship.get_node("ExtensionSystems").set_physics_process(false)
|
|
for enemy in get_tree().get_nodes_in_group("enemies"): enemy.queue_free()
|
|
ship.position = Vector2(0,1500)
|
|
ship.rotation = 0.0
|
|
ship.get_node("Camera2D").reset_smoothing()
|
|
ship.max_energy = 100.0
|
|
ship.energy = 100.0
|
|
ship.max_shields = 100.0
|
|
ship.shields = 100.0
|
|
var item := ItemInstance.new()
|
|
item.definition = preload("res://resources/items/auxiliary_shield.tres")
|
|
var inventory: ShipInventory = ship.get_node("ShipInventory")
|
|
inventory.extension_slots[0] = item
|
|
inventory.inventory_changed.emit()
|
|
assert(ship.activate_ability(0))
|
|
var layer := CanvasLayer.new()
|
|
layer.layer = 100
|
|
add_child(layer)
|
|
var panel := PanelContainer.new()
|
|
panel.position = Vector2(330,80)
|
|
var style := StyleBoxFlat.new()
|
|
style.bg_color = Color("100a21ec")
|
|
style.border_color = Color("ba8cff")
|
|
style.set_border_width_all(1)
|
|
style.set_corner_radius_all(8)
|
|
style.set_content_margin_all(14)
|
|
panel.add_theme_stylebox_override("panel",style)
|
|
layer.add_child(panel)
|
|
var row := HBoxContainer.new()
|
|
row.add_theme_constant_override("separation",14)
|
|
panel.add_child(row)
|
|
var icon := TextureRect.new()
|
|
icon.texture = item.definition.icon
|
|
icon.custom_minimum_size = Vector2(80,80)
|
|
icon.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
|
|
icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
|
row.add_child(icon)
|
|
var text := Label.new()
|
|
text.text = "TARCZA ZEWNĘTRZNA\n70% maks. energii → osłona 50% maks. tarcz\nOsobna większa warstwa · pochłania obrażenia jako pierwsza"
|
|
text.add_theme_font_size_override("font_size",15)
|
|
row.add_child(text)
|
|
for frame in 15: await get_tree().process_frame
|
|
await RenderingServer.frame_post_draw
|
|
assert(get_viewport().get_texture().get_image().save_png("res://artifacts/auxiliary_shield_preview.png") == OK)
|
|
print("AUXILIARY_SHIELD_PREVIEW: PASS")
|
|
get_tree().quit()
|