Battle test scene
This commit is contained in:
parent
2d4d44d224
commit
fd876a0bed
|
@ -1,6 +1,5 @@
|
||||||
extends Control
|
extends Control
|
||||||
const palette_mat := preload('res://palette_mat.tres')
|
const palette_mat := preload('res://palette_mat.tres')
|
||||||
const battle_bg_shader = preload('res://shaders/tilemap_shader.gdshader')
|
|
||||||
var save_slots = []
|
var save_slots = []
|
||||||
var save_slot_dicts = []
|
var save_slot_dicts = []
|
||||||
|
|
||||||
|
@ -36,18 +35,19 @@ func _ready():
|
||||||
t.material.set_shader_param('palette', mon.palette)
|
t.material.set_shader_param('palette', mon.palette)
|
||||||
monster_box.add_child(t)
|
monster_box.add_child(t)
|
||||||
|
|
||||||
var battle_bg_mat := ShaderMaterial.new()
|
#var battle_bg := OptionButton.new()
|
||||||
battle_bg_mat.shader = battle_bg_shader
|
#for i in len(SpriteLoader.battle_backgrounds):
|
||||||
# var bg = SpriteLoader.battle_backgrounds[1]
|
# battle_bg.add_item('BG %d' % i)
|
||||||
for bg in SpriteLoader.battle_backgrounds.slice(0, 2):
|
#battle_bg.connect('item_focused', $BattleScene, 'set_bg')
|
||||||
var t := TextureRect.new()
|
#battle_bg.connect('item_selected', $BattleScene, 'set_bg')
|
||||||
t.material = battle_bg_mat.duplicate()
|
#add_child(battle_bg)
|
||||||
t.texture = bg.tilemap_tex
|
var bbg := SpinBox.new()
|
||||||
t.material.set_shader_param('palette', bg.palette_texs[0])
|
bbg.max_value = len(SpriteLoader.battle_backgrounds) - 1
|
||||||
t.material.set_shader_param('tile_atlas', bg.tile_atlas_texs[0])
|
bbg.connect('value_changed', $BattleScene, 'set_bg')
|
||||||
t.rect_scale = Vector2(8, 8)
|
bbg.rect_min_size.x = 32
|
||||||
t.name = 'BattleBG'
|
bbg.align = LineEdit.ALIGN_RIGHT
|
||||||
add_child(t)
|
add_child(bbg)
|
||||||
|
|
||||||
# var lbl = Label.new()
|
# var lbl = Label.new()
|
||||||
# for i in 22:
|
# for i in 22:
|
||||||
# lbl.text = lbl.text + '%s - %s\n' % [StringLoader.get_job_name(i), StringLoader.get_job_desc(i)]
|
# lbl.text = lbl.text + '%s - %s\n' % [StringLoader.get_job_name(i), StringLoader.get_job_desc(i)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=8 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://widgets/PartyMenu.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://widgets/PartyMenu.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://test/worldmap_system.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://test/worldmap_system.tscn" type="PackedScene" id=2]
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
[ext_resource path="res://test/battle_sprites.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://test/battle_sprites.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://test/audio_system.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://test/audio_system.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://theme/menu_theme.tres" type="Theme" id=6]
|
[ext_resource path="res://theme/menu_theme.tres" type="Theme" id=6]
|
||||||
|
[ext_resource path="res://widgets/BattleScene.tscn" type="PackedScene" id=7]
|
||||||
|
|
||||||
[node name="Control" type="Control"]
|
[node name="Control" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
|
@ -25,4 +26,9 @@ position = Vector2( -600, -550 )
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
[node name="PartyMenu" parent="." instance=ExtResource( 1 )]
|
[node name="PartyMenu" parent="." instance=ExtResource( 1 )]
|
||||||
|
visible = false
|
||||||
|
margin_right = 320.0
|
||||||
|
|
||||||
|
[node name="BattleScene" parent="." instance=ExtResource( 7 )]
|
||||||
|
margin_left = 64.0
|
||||||
margin_right = 320.0
|
margin_right = 320.0
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_resource type="Theme" load_steps=19 format=2]
|
[gd_resource type="Theme" load_steps=20 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://3rd_party/sysfont/dynamicfont.tres" type="DynamicFont" id=1]
|
[ext_resource path="res://3rd_party/sysfont/dynamicfont.tres" type="DynamicFont" id=1]
|
||||||
[ext_resource path="res://theme/border_stylebox.tres" type="StyleBox" id=2]
|
[ext_resource path="res://theme/border_stylebox.tres" type="StyleBox" id=2]
|
||||||
|
@ -30,6 +30,10 @@ margin_right = 3.0
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id=5]
|
[sub_resource type="StyleBoxEmpty" id=5]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id=11]
|
||||||
|
atlas = ExtResource( 9 )
|
||||||
|
region = Rect2( 1, 55, 7, 8 )
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id=6]
|
[sub_resource type="ImageTexture" id=6]
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id=7]
|
[sub_resource type="ImageTexture" id=7]
|
||||||
|
@ -61,6 +65,10 @@ Label/constants/line_spacing = 1
|
||||||
Label/constants/shadow_as_outline = 0
|
Label/constants/shadow_as_outline = 0
|
||||||
Label/constants/shadow_offset_x = 1
|
Label/constants/shadow_offset_x = 1
|
||||||
Label/constants/shadow_offset_y = 1
|
Label/constants/shadow_offset_y = 1
|
||||||
|
LineEdit/constants/minimum_spaces = 2
|
||||||
|
LineEdit/styles/focus = ExtResource( 2 )
|
||||||
|
LineEdit/styles/normal = ExtResource( 2 )
|
||||||
|
LineEdit/styles/read_only = ExtResource( 2 )
|
||||||
OptionButton/constants/arrow_margin = 0
|
OptionButton/constants/arrow_margin = 0
|
||||||
OptionButton/constants/hseparation = 0
|
OptionButton/constants/hseparation = 0
|
||||||
OptionButton/styles/disabled = ExtResource( 2 )
|
OptionButton/styles/disabled = ExtResource( 2 )
|
||||||
|
@ -73,6 +81,7 @@ PanelContainer/styles/panel = ExtResource( 2 )
|
||||||
PopupMenu/styles/hover = ExtResource( 2 )
|
PopupMenu/styles/hover = ExtResource( 2 )
|
||||||
PopupMenu/styles/panel = ExtResource( 2 )
|
PopupMenu/styles/panel = ExtResource( 2 )
|
||||||
PopupMenu/styles/panel_disabled = ExtResource( 2 )
|
PopupMenu/styles/panel_disabled = ExtResource( 2 )
|
||||||
|
SpinBox/icons/updown = SubResource( 11 )
|
||||||
TabContainer/colors/font_color_bg = Color( 0.501961, 0.501961, 0.501961, 1 )
|
TabContainer/colors/font_color_bg = Color( 0.501961, 0.501961, 0.501961, 1 )
|
||||||
TabContainer/colors/font_color_fg = Color( 1, 1, 1, 1 )
|
TabContainer/colors/font_color_fg = Color( 1, 1, 1, 1 )
|
||||||
TabContainer/styles/panel = ExtResource( 2 )
|
TabContainer/styles/panel = ExtResource( 2 )
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
extends ReferenceRect
|
||||||
|
const battle_bg_shader = preload('res://shaders/tilemap_shader.gdshader')
|
||||||
|
|
||||||
|
var bg: SpriteLoader.BattleBackground
|
||||||
|
var pal_l: int
|
||||||
|
var atlas_l: int
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
var battle_bg_mat := ShaderMaterial.new()
|
||||||
|
battle_bg_mat.shader = battle_bg_shader
|
||||||
|
$background.material = battle_bg_mat
|
||||||
|
set_bg(1)
|
||||||
|
|
||||||
|
func set_bg(index: int) -> void:
|
||||||
|
self.bg = SpriteLoader.battle_backgrounds[index]
|
||||||
|
self.pal_l = len(self.bg.palette_texs)
|
||||||
|
self.atlas_l = len(self.bg.tile_atlas_texs)
|
||||||
|
$background.texture = self.bg.tilemap_tex
|
||||||
|
$background.material.set_shader_param('palette', self.bg.palette_texs[0])
|
||||||
|
$background.material.set_shader_param('tile_atlas', self.bg.tile_atlas_texs[0])
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
var t := 0.0
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if not self.bg:
|
||||||
|
return
|
||||||
|
self.t = fmod(self.t + delta, 2.0)
|
||||||
|
$background.material.set_shader_param('palette', self.bg.palette_texs[int(self.t * 30) % self.pal_l])
|
||||||
|
$background.material.set_shader_param('tile_atlas', self.bg.tile_atlas_texs[int(self.t * 7.5) % self.atlas_l])
|
|
@ -0,0 +1,20 @@
|
||||||
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://widgets/BattleScene.gd" type="Script" id=1]
|
||||||
|
|
||||||
|
[node name="BattleScene" type="ReferenceRect"]
|
||||||
|
margin_right = 256.0
|
||||||
|
margin_bottom = 240.0
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="background" type="TextureRect" parent="."]
|
||||||
|
margin_right = 32.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
rect_min_size = Vector2( 32, 20 )
|
||||||
|
rect_scale = Vector2( 8, 8 )
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="."]
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_top = -80.0
|
Loading…
Reference in New Issue